This package consists of a collection of network algorithms. In short, the major difference between MatrixNetworks.jl and packages like LightGraphs.jl or Graphs.jl is the way graphs are treated.
In LightGraphs.jl, graphs are created through Graph() and DiGraph() which are based on the representation of G as G = (V,E). Similar types exist in Graphs.jl (EdgeList, AdjacencyList, IncidenceList, Graph) - this is again based on viewing a graph G as a set of nodes and edges. Our viewpoint is different.
MatrixNetworks is based on the philosophy that there should be no distinction between a matrix and a network - thus the name.
d,dt,p = bfs(A,1) computes the bfs distance from the node represented by row 1 to all other nodes of the graph with adjacency matrix A. (A can be of type
MatrixNetwork). This representation can be easier to work with and handle.
The package provides documentation with sample runs for all functions - viewable through Juila’s REPL. These sample runs come with sample data, which makes it easier for users to get started on
Pkg.add("MatrixNetworks") using MatrixNetworks
Acc is a sparse matrix containing the largest connected piece of a directed graph A p is a logical vector indicating which vertices in A were chosen
A = load_matrix_network("dfs_example") Acc,p = largest_component(A)
cc is the clustering coefficients
A = load_matrix_network("clique-10") cc = clustercoeffs(MatrixNetwork(A))
d is a vector containing the distances of all nodes from node u (1 in the example below) dt is a vector containing the discover times of all the nodes pred is a vector containing the predecessors of each of the nodes
A = load_matrix_network("bfs_example") d,dt,pred = bfs(A,1)
A = load_matrix_network("cores_example") sc = scomponents(A) sc.number #number of connected componenets sc.sizes #sizes of components sc.map #the mapping of the graph nodes to their respective connected component strong_components_map(A) # if you just want the map sc_enrich = enrich(sc) # produce additional enriched output includes: sc_enrich.reduction_matrix sc_enrich.transitive_map sc_enrich.transitive_order
Can work on ei,ej:
ei = [1;2;3] ej = [2;4;1] scomponents(ei,ej)
ei = [1;2;3] ej = [3;2;4] BM = bipartite_matching([10;12;13],ei,ej) BM.weight BM.cardinality BM.match create_sparse(BM) # get the sparse matrix edge_list(BM)) # get the edgelist edge_indicator(BM,ei,ej) # get edge indicators
12 days ago