docs.rs failed to build graphrs-0.11.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
graphrs-0.11.11
graphrs
graphrs
is a Rust package for the creation, manipulation and analysis of graphs.
It allows graphs to be created with support for:
- directed and undirected edges
- multiple edges between two nodes
- self-loops
A Graph
has two generic arguments:
T
: Specifies the type to use for node names.A
: Specifies the type to use for node and edge attributes. Attributes are optional extra data that are associated with a node or an edge. For example, if nodes represent people andT
is ani32
of their employee ID then the node attributes might store their first and last names.
Documentation
The doc.rs documentation is here.
Python bindings
Python bindings are available in the graphrs-python package.
Major structs
Graph
Node
Edge
Modules
algorithms::centrality
algorithms::cluster
algorithms::community
algorithms::components
algorithms::structural_holes
algorithms::shortest_path
generators
readwrite
Examples
Create a weighted, directed graph
use ;
let nodes = vec!;
let edges = vec!;
let specs = directed;
let graph = new_from_nodes_and_edges;
Create an undirected graph from just edges
use ;
let mut graph: = new;
let result = graph.add_edges;
Create an empty graph with all possible specifications
use ;
let graph = new;
Generate graphs
use ;
let graph_complete = complete_graph;
let graph_random = fast_gnp_random_graph;
Find the shortest path between two nodes
use ;
use ;
let mut graph = new;
graph.add_edges;
let shortest_paths = single_source;
assert_eq!;
Compute the betweenness, closeness and eigenvector centrality for all nodes
use ;
let graph = karate_club_graph;
let centralities = betweenness_centrality;
let closeness = closeness_centrality;
let centralities = eigenvector_centrality;
Detect communities within a graph
use ;
let graph = karate_club_graph;
let partitions = louvain_partitions;
Read and write graphml files
use ;
let graph = read_graphml_file;
write_graphml;
Get an adjacency matrix
This is an optional feature. Enable in Cargo.toml with:
graphrs = { version = "x.y.z", features = ["adjacency_matrix"] }
use generators;
let graph = karate_club_graph;
let matrix = graph.get_sparse_adjacency_matrix.unwrap;
Performance
A comparison of the performance of graphrs
against NetworkX
, igraph
and graph-tool
can be found here.
Credits
Some of the structure of the API and some of the algorithms were inspired by NetworkX.
License
MIT