### Petgraph Shorthand Types Source: https://docs.rs/petgraph/0.6/petgraph Defines shorthand type aliases for common graph configurations in petgraph. For example, `DiGraph<_, _>` is an alias for `Graph<_, _, Directed>`, and `UnMatrix<_, _>` is an alias for `MatrixGraph<_, _, Undirected>`. Specific shorthand types for each graph type are listed in their respective module documentation. ```rust use petgraph::graph::{Graph, DiGraph}; use petgraph::matrix_graph::{MatrixGraph, UnMatrix}; // Example usage of shorthand types: let directed_graph: DiGraph<_, _> = Graph::new(); let undirected_matrix_graph: UnMatrix<_, _> = MatrixGraph::new(); ``` -------------------------------- ### Basic Graph Operations and Algorithms Source: https://docs.rs/petgraph/0.6/petgraph Demonstrates creating an undirected graph, finding the shortest path using Dijkstra's algorithm, calculating the minimum spanning tree, and outputting the graph in DOT format. ```rust use petgraph::graph::{NodeIndex, UnGraph}; use petgraph::algo::{dijkstra, min_spanning_tree}; use petgraph::data::FromElements; use petgraph::dot::{Dot, Config}; // Create an undirected graph with `i32` nodes and edges with `()` associated data. let g = UnGraph::::from_edges(&[ (1, 2), (2, 3), (3, 4), (1, 4)]); // Find the shortest path from `1` to `4` using `1` as the cost for every edge. let node_map = dijkstra(&g, 1.into(), Some(4.into()), |_| 1); assert_eq!(&1i32, node_map.get(&NodeIndex::new(4)).unwrap()); // Get the minimum spanning tree of the graph as a new graph, and check that // one edge was trimmed. let mst = UnGraph::<_, _>::from_elements(min_spanning_tree(&g)); assert_eq!(g.raw_edges().len() - 1, mst.raw_edges().len()); // Output the tree to `graphviz` `DOT` format println!("{:?}", Dot::with_config(&mst, &[Config::EdgeNoLabel])); ``` -------------------------------- ### petgraph Platform Support Source: https://docs.rs/petgraph/0.6/petgraph Lists the different target platforms for which the petgraph crate version 0.6.5 has build information available on docs.rs. ```Rust Platform Builds: i686-pc-windows-msvc i686-unknown-linux-gnu x86_64-apple-darwin x86_64-pc-windows-msvc x86_64-unknown-linux-gnu ``` -------------------------------- ### petgraph Crate Information Source: https://docs.rs/petgraph/0.6/petgraph Provides metadata and links for the petgraph crate version 0.6.5. Includes license information, source code browsing, and links to related resources on crates.io and docs.rs. ```Rust Crate: petgraph 0.6.5 License: MIT OR Apache-2.0 Source: https://github.com/petgraph/petgraph Crates.io: https://crates.io/crates/petgraph Docs.rs: https://docs.rs/petgraph/0.6.5/petgraph/ ``` -------------------------------- ### petgraph Dependencies Source: https://docs.rs/petgraph/0.6/petgraph Lists the direct and optional dependencies for the petgraph crate version 0.6.5, including version constraints. ```Rust Dependencies: fixedbitset ^0.4.0 indexmap ^2.0 quickcheck ^0.8 (optional) rayon ^1.5.3 (optional) serde ^1.0 (optional) serde_derive ^1.0 (optional) ``` -------------------------------- ### petgraph Development Dependencies Source: https://docs.rs/petgraph/0.6/petgraph Lists the development dependencies for the petgraph crate version 0.6.5, used for testing and development purposes. ```Rust Development Dependencies: ahash ^0.7.2 bincode ^1.3.3 defmac ^0.2.1 fxhash ^0.2.1 itertools ^0.12.1 odds ^0.4.0 rand ^0.5.5 ``` -------------------------------- ### Petgraph Modules Overview Source: https://docs.rs/petgraph/0.6/petgraph Provides a list of the primary modules within the petgraph crate, each serving a specific purpose. This includes modules for adjacency lists, algorithms, compressed sparse row representation, data traits, Graphviz dot file output, different graph implementations (graph, graphmap, matrix_graph, stable_graph), operators, prelude, union-find data structures, and graph traversals. ```APIDOC Modules: adj: Simple adjacency list. algo: Graph algorithms. csr: Compressed Sparse Row (CSR) graph representation. data: Traits for graph data and construction. dot: Graphviz dot file format output. graph: Adjacency list graph implementation (`Graph`). graphmap: Graph implementation using node values as keys (`GraphMap`). matrix_graph: Adjacency matrix graph implementation (`MatrixGraph`). operator: Operators for creating new graphs. prelude: Commonly used items. stable_graph: Graph implementation with stable node indices (`StableGraph`). unionfind: Disjoint-set data structure (`UnionFind`). visit: Graph traits and traversals. ``` -------------------------------- ### petgraph Documentation Coverage Source: https://docs.rs/petgraph/0.6/petgraph Indicates the percentage of the petgraph crate version 0.6.5 that is documented, as reported by docs.rs. ```Rust Documentation Coverage: 75.89% ``` -------------------------------- ### Petgraph Crate Features Source: https://docs.rs/petgraph/0.6/petgraph Lists the optional features available for the petgraph crate. These features can be enabled to add specific functionalities, such as serialization support via the `serde-1` feature or enabling different graph implementations like `GraphMap`, `StableGraph`, and `MatrixGraph`. ```rust #[cfg(feature = "serde-1")] // Enables serialization for Graph, StableGraph, GraphMap using serde 1.0. #[cfg(feature = "graphmap")] // Enables GraphMap struct. #[cfg(feature = "stable_graph")] // Enables StableGraph struct. #[cfg(feature = "matrix_graph")] // Enables MatrixGraph struct. ``` -------------------------------- ### Petgraph Traits Source: https://docs.rs/petgraph/0.6/petgraph Outlines the key traits defined in the petgraph crate for abstracting graph operations. `EdgeType` defines the characteristic of a graph's edges (directed or not), and `IntoWeightedEdge` provides a way to convert various inputs into a weighted edge tuple. ```APIDOC Traits: EdgeType: Defines whether a graph has directed edges. IntoWeightedEdge: Converts elements into source, target, and edge weight triples. ``` -------------------------------- ### Petgraph Re-exports Source: https://docs.rs/petgraph/0.6/petgraph Highlights items that are re-exported from the petgraph crate's internal modules, making them directly accessible from the top level. This includes the main `Graph` struct and `Direction` enum variants like `Incoming` and `Outgoing`. ```rust pub use petgraph::graph::Graph; pub use petgraph::Direction::Incoming; pub use petgraph::Direction::Outgoing; ``` -------------------------------- ### Petgraph Enums Source: https://docs.rs/petgraph/0.6/petgraph Details the enumerations provided by the petgraph crate. These include `Directed` and `Undirected` as marker types for graph edge directionality, and `Direction` which specifies edge direction (e.g., `Incoming`, `Outgoing`). ```APIDOC Enums: Directed: Marker type for a directed graph. Direction: Represents edge direction (Incoming, Outgoing). Undirected: Marker type for an undirected graph. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.