Plotting A Network Using A Co-occurrence Matrix
I want to plot a network in Python using a co-occurence matrix as an input, such that nodes that have a non-zero co-occurence count are connected, and the weight of the edges is pr
Solution 1:
You might find NetworkX to be a useful tool for that. You can easily feed it the input nodes and edges in several ways.
In the case that you want to generate your network using a co-occurrence matrix, you can use NetworkX's method from_numpy_matrix, which allows you to create a graph from a numpy matrix matrix which will be interpreted as an adjacency matrix.
Here's a simply toy example from the documentation:
import numpy as np
import networkx as nx
A=np.matrix([[1,1],[2,1]])
G=nx.from_numpy_matrix(A)
Solution 2:
It is indeed possible to do something like that with networkx
Check this: https://stackoverflow.com/a/25651827/4288795
With it you can generate graphs like this:
Solution 3:
You can export the information to a graphml file format and use yEd Graph Editor to navigate and format the contents of your networkx graph.
Post a Comment for "Plotting A Network Using A Co-occurrence Matrix"