How to compute the propinquity of a graph in R? - r

I would like to test if the geographical location of my vertices (ie I have a matrix giving the distance between each pair of actors of my network) has an influence on the presence/absence of edges. If I have correctly understood, this feature is called propinquity....
In other words, I would like to know if two vertices are more likely (or less likely) to be connected if their distance is small.
Do you have any idea of how to do that in R? I usually use igraph but if another library does that I will use it of course :-).

Related

What is the most efficient way to represent an directed dynamic massive 3D graph?

I know that there are many techniques to represent graphs.
Suppose I have a directed massive 3D graph with 100,000 nodes at maximum.
Suppose the graph looks somewhat like the following:
Suppose each node of the graph has three pieces of information:
A 30-character string as a label
floating point values as coordinates
three integer values
The graph is dynamic. I.e., connections frequently change, and the nodes frequently change their coordinates.
What would be the most efficient way to represent this graph in computer memory so that I can apply mathematical operations on each node?
Should I use data structures, or should I use big-data analytics or ML?

graph similarity having multiple edges between two nodes

There are many theories about calculating of graph similarity such as vertex edge overlap, jacard, co-sine, edit distance, signature similarity, lambda distance, deltacon so on. These things are based on single edge of the graph. But there are many graphs having multiple edges in real world.
Given similar two graphs like above, how could we calculate graph similarity?
Using previous graph similarity, there are only 2-dimension vector and the entry is just scalar that is number, but in multiple edge's graph, the entry should be tuple. Because there are one more actions between nodes. For the previous method, it could be called who-knows-whom schem, but latter graph, it could be said who-knows-whom*-how*. I think the previous mothods could be used for the multiple edge's graph easily, so there aren't logic or methods about it.
Thanks in advance!
There is not "the" way yo compute graph similarity.
Depending on your data and problem, very different approaches may be good. In many cases, simply merging the two edges into one makes perfect sense. For example, if I have two roads of capacity x and y to go from A to B - for many analyses this is comparable to having just one rode, with the combined capacity.

Graph distances as a dist object

I have a graph with undirected weighted links, and I want to process the graph distance between all of its pairs of nodes. Because it is a large graph, I would like to get the result as a dist object (by opposition to a full, symmetric, matrix).
Is there a way to do that with igraph? According to the documentation, it doesn't seem so, but I may be missing something. Obviously, I don't want to get the full symmetric matrix and convert it using as.dist().
Is there any alternative R library allowing to get this result?
Thanks.

R: Adding vertex attributes to a network (using statnet)

I'm currently doing a Network Analysis in R, using the Statnet package (http://statnet.csde.washington.edu/)
So far I have been able to:
1) Construct Social Networks using the network() function. The information I had was originally contained in a incidence matrix form (one row per project, project members in the columns), which I transformed to adjency (socio-matrix) form before building the networks in R.
2) Plot the networks and compute general statistics (both for the overall network and for network vertexes)
3) Add external vertex attributes to the networks
4) Plot the networks with vertexes in different colors according to their attributes.
Right now I would like to complement my analysis by adding edge attributes to the network (to differentiate relationships, for example different kinds of projects).
I know I can use the set.edge.attribute() function, and that I need to input a vector of the same size as the total of edges that exist in the network. However, I don't know exactly how to sort this vector of edge attributes, in order for the function to assign them correctly to the corresponding edges.
Anybody knows how the network() function sorts edges internally? Any ideas on how to sort my vector of edge attributes in order to get a appropriate matching?
Thanks in advance for your help!
The network() function can create networks from various types of inputs (such as an edgelist or an adjacency matrix) so it would help if you gave a bit more of a code example explaining how you are creating the network and the format of the structure your edge attribute data are in.
I believe that in general network() will create the edges in the same order as the input edgelist. So if your edge attribute vector is in the same order as your original data, you should be able to use set.edge.attribute() safely. If your edge attributes are in a matrix form, you can use set.edge.value().

Graph Drawing With Weighted Edges

I'm looking to build an algorithm (or reuse one) that organizes nodes and edges on a 2 dimensional canvas where edges can have corresponding weights.
Any starting material and info would be helpful.
What would the weights do to affect their placement on your canvas?
That being said, you might want to look into graphviz and, more specifically, the DOT language, which organizes nodes on a canvas.
Many graph visualization frameworks use a force-based simulation, in which all nodes exert a repulsive force against each other (with their mass being their size), and edges exert tension on the nodes they connect. This creates aesthetically-arranged graph visualizations.
Although again, I'm not sure where you want node "weights" to come into play. Do you want weighted nodes to be more in the center? To be larger? More further apart?
Many graph/network layout algorithms are implicitly capable of handling weighted networks, but you may need to do some pre-processing and tweaks to the implementation to get it to work. Usually the first step is to determine if your weights represent "similarities" (usually interpreted to mean that stronger weights should place nodes closer togeter) or "dissimilarities" (stronger weights = father apart). The most common case is the former, so you will need to translate them to dissimilarities, often done by subtracting each edge value from the maximum observed edge value in the network. The matrix of dissimilarity values for each edge can then be fed to the algorithm and interpreted as desired distances in the layout space for each edge (i.e. "spring lengths")--usually after multiplying by some constant to transform to display units (pixels).
If you tell me what language you are using, I may be able to point you to some code examples.

Resources