I\'m trying to get into creating network graphs and generating sparse matrices from them. From the wikipedia Laplacian matrix
example, I decided to try and recreat
How to convert from graph to adjacency matrix:
import scipy as sp
import networkx as nx
G=nx.fast_gnp_random_graph(100,0.04)
adj_matrix = nx.adjacency_matrix(G)
Here's the documentation.
And from adjacency matrix to graph:
H=nx.Graph(adj_matrix) #if it's directed, use H=nx.DiGraph(adj_matrix)
Here's the documentation.