# VR in Network Visualization(Force Directed Network in Unity)

By Dave Song (Spring 2023)

this page is mainly focusing on community detection & cluster visualization.

## What is a Network?

In the context of community detection, a network, also known as a graph, is a mathematical representation of a collection of interconnected entities called nodes or vertices. These nodes can represent anything from people in a social network to proteins in a biological system.

Community detection in a network refers to the process of identifying groups of nodes that are more densely connected to each other than to nodes in other groups. These groups are called communities or clusters, and their identification can reveal important structural and functional properties of the network.

Therefore, a formal definition of a community detection network would be a mathematical representation of a collection of interconnected entities (nodes or vertices) and their relationships (edges).

## Finding Communities/Clusters

First it is important to distinguish the difference between Community detection vs. clustering

For now, we will focus on community detection techniques

Here are brief overview of some community detection techniques

"Louvain is an unsupervised algorithm (does not require the input of the number of communities nor their sizes before execution) divided in 2 phases: Modularity Optimization and Community Aggregation. After the first step is completed, the second follows. Both will be executed until there are no more changes in the network and maximum modularity is achieved."  Source

Additional to phases used in the first algorithm introduced, Leiden use one more phase that improves already discovered partitions. The additional refinement phrase further splits into multiple partitions.

For more in-depth information on other community detection, take a look at this article

However, as the network gets large, the number of edges grows exponentially -- often it difficult to analyze communities and individual connections between nodes(or people). Therefore, my project explored the difference between 2D community network visualization network vs. 3D community network in VR.

To learn more about generating 2D network visualization, please feel free to visit this page.  I go through steps to generate 2D community network using Gephi, a 2d network visualization software.

## Community Detection in Unity

I was originally using Gephi for 2D representation because the older version of Gephi used to provide 3D rendering of the networks. However, the newer version of Gephi removed this functionality. Therefore, I had to implement 3D representation of network in Unity.

Community Detection in Unity

Creating the network in unity was done by using another approach called force directed approach. Force Directed Graphs are produced using two components.

- Spring joints: Joints in Unity connects two objects. Using spring joints, it is possible to represent “connection” among nodes.

- colliders: in order to prevent nodes overlapping each other, colliders are wrapping individual node with a set distance.

Therefore, a node with more connections will get closer to the center of the graph while nodes with less connections will get pushed to the outer layer of the network.

Here is a source git repository I used to develop my project.