Skip to main content
Ctrl+K

graph-tool documentation
(2.97)

  • GitLab
  • Mastodon
  • Bluesky
  • Discourse
  • graph-tool
  • Welcome to graph-tool’s documentation!
  • Quick start guide
  • Parallel algorithms
  • Cookbook guides
    • Inferring modular network structure
    • Uncertain network reconstruction
    • Network reconstruction from dynamics and behavior
    • Animations with graph-tool
    • Integration with matplotlib
    • Writing extensions in C++
  • Submodules
    • graph_tool
      • Graph
      • GraphView
      • Vertex
      • Edge
      • PropertyMap
      • VertexPropertyMap
      • EdgePropertyMap
      • GraphPropertyMap
      • PropertyArray
      • group_vector_property
      • ungroup_vector_property
      • map_property_values
      • infect_vertex_property
      • edge_endpoint_property
      • incident_edges_op
      • perfect_prop_hash
      • value_types
      • load_graph
      • load_graph_from_csv
      • openmp_enabled
      • openmp_get_num_threads
      • openmp_set_num_threads
      • openmp_get_schedule
      • openmp_set_schedule
      • openmp_get_thresh
      • openmp_set_thresh
      • show_config
    • graph_tool.centrality
      • pagerank
      • betweenness
      • central_point_dominance
      • closeness
      • eigenvector
      • katz
      • hits
      • eigentrust
      • trust_transitivity
    • graph_tool.clustering
      • local_clustering
      • global_clustering
      • extended_clustering
      • motifs
      • motif_significance
    • graph_tool.collection
      • LCF_graph
      • bull_graph
      • chvatal_graph
      • cubical_graph
      • desargues_graph
      • diamond_graph
      • dodecahedral_graph
      • frucht_graph
      • heawood_graph
      • hoffman_singleton_graph
      • house_graph
      • icosahedral_graph
      • krackhardt_kite_graph
      • moebius_kantor_graph
      • octahedral_graph
      • pappus_graph
      • petersen_graph
      • sedgewick_maze_graph
      • tetrahedral_graph
      • truncated_cube_graph
      • truncated_tetrahedron_graph
      • tutte_graph
    • graph_tool.correlations
      • assortativity
      • scalar_assortativity
      • corr_hist
      • combined_corr_hist
      • avg_neighbor_corr
      • avg_combined_corr
    • graph_tool.dynamics
      • DiscreteStateBase
      • EpidemicStateBase
      • SIState
      • SISState
      • SIRState
      • SIRSState
      • VoterState
      • MajorityVoterState
      • BinaryThresholdState
      • IsingGlauberState
      • CIsingGlauberState
      • IsingMetropolisState
      • PottsGlauberState
      • PottsMetropolisState
      • AxelrodState
      • BooleanState
      • KirmanState
      • NormalState
      • LinearNormalState
      • ContinuousStateBase
      • LinearState
      • LVState
      • KuramotoState
      • BPBaseState
      • GenPottsBPState
      • IsingBPState
      • NormalBPState
    • graph_tool.draw
      • sfdp_layout
      • fruchterman_reingold_layout
      • arf_layout
      • radial_tree_layout
      • planar_layout
      • random_layout
      • graph_draw
      • draw_hierarchy
      • graphviz_draw
      • prop_to_size
      • get_hierarchy_control_points
      • cairo_draw
      • interactive_window
      • GraphWidget
      • GraphWindow
      • GraphArtist
    • graph_tool.flow
      • edmonds_karp_max_flow
      • push_relabel_max_flow
      • boykov_kolmogorov_max_flow
      • min_st_cut
      • min_cut
    • graph_tool.generation
      • random_graph
      • random_rewire
      • add_random_edges
      • remove_random_edges
      • generate_triadic_closure
      • price_network
      • generate_sbm
      • generate_maxent_sbm
      • solve_sbm_fugacities
      • generate_knn
      • geometric_graph
      • triangulation
      • predecessor_tree
      • line_graph
      • condensation_graph
      • contract_parallel_edges
      • remove_parallel_edges
      • expand_parallel_edges
      • label_parallel_edges
      • remove_self_loops
      • label_self_loops
      • graph_projection
      • graph_merge
      • graph_union
      • graph_difference
      • graph_sym_difference
      • graph_intersection
      • lattice
      • complete_graph
      • circular_graph
    • graph_tool.inference
      • minimize_blockmodel_dl
      • minimize_nested_blockmodel_dl
      • BlockState
      • OverlapBlockState
      • LayeredBlockState
      • NestedBlockState
      • PPBlockState
      • RankedBlockState
      • ModularityState
      • NormCutState
      • TemperingState
      • CliqueState
      • EntropyState
      • MCMCState
      • MultiflipMCMCState
      • MultilevelMCMCState
      • GibbsMCMCState
      • MulticanonicalMCMCState
      • ExhaustiveSweepState
      • DrawBlockState
      • mcmc_equilibrate
      • mcmc_anneal
      • multicanonical_equilibrate
      • MulticanonicalState
      • PartitionModeState
      • ModeClusterState
      • PartitionCentroidState
      • partition_overlap
      • nested_partition_overlap
      • variation_information
      • mutual_information
      • reduced_mutual_information
      • contingency_graph
      • shuffle_partition_labels
      • order_partition_labels
      • order_nested_partition_labels
      • align_partition_labels
      • align_nested_partition_labels
      • partition_overlap_center
      • nested_partition_overlap_center
      • nested_partition_clear_null
      • contiguous_map
      • nested_contiguous_map
      • mf_entropy
      • bethe_entropy
      • microstate_entropy
      • marginal_multigraph_entropy
      • half_edge_graph
      • get_block_edge_gradient
      • PartitionHist
      • BlockPairHist
      • LatentLayerBaseState
      • LatentMultigraphBlockState
      • LatentClosureBlockState
      • MeasuredBlockState
      • MeasuredClosureBlockState
      • MixedMeasuredBlockState
      • UncertainBlockState
      • UncertainBaseState
      • latent_multigraph
      • DynamicsBlockStateBase
      • BPBlockStateBase
      • PseudoNormalBlockState
      • NormalGlauberBlockState
      • LinearNormalBlockState
      • LVBlockState
      • EpidemicsBlockState
      • IsingBlockStateBase
      • IsingGlauberBlockState
      • CIsingGlauberBlockState
      • PseudoIsingBlockState
      • PseudoCIsingBlockState
      • PottsBlockStateBase
      • PottsGlauberBlockState
      • PseudoPottsBlockState
      • EMBlockState
      • em_infer
      • modularity
    • graph_tool.search
      • bfs_search
      • bfs_iterator
      • dfs_search
      • dfs_iterator
      • dijkstra_search
      • dijkstra_iterator
      • astar_search
      • astar_iterator
      • bellman_ford_search
      • BFSVisitor
      • DFSVisitor
      • DijkstraVisitor
      • BellmanFordVisitor
      • AStarVisitor
      • StopSearch
    • graph_tool.spectral
      • adjacency
      • laplacian
      • incidence
      • transition
      • modularity_matrix
      • hashimoto
      • AdjacencyOperator
      • LaplacianOperator
      • IncidenceOperator
      • TransitionOperator
      • HashimotoOperator
      • CompactHashimotoOperator
    • graph_tool.stats
      • vertex_hist
      • edge_hist
      • vertex_average
      • edge_average
      • distance_histogram
    • graph_tool.topology
      • shortest_distance
      • shortest_path
      • random_shortest_path
      • count_shortest_paths
      • all_shortest_paths
      • all_predecessors
      • all_paths
      • all_circuits
      • pseudo_diameter
      • similarity
      • vertex_similarity
      • isomorphism
      • subgraph_isomorphism
      • mark_subgraph
      • max_cliques
      • max_cardinality_matching
      • max_independent_vertex_set
      • min_spanning_tree
      • random_spanning_tree
      • dominator_tree
      • topological_sort
      • transitive_closure
      • label_components
      • label_biconnected_components
      • label_largest_component
      • extract_largest_component
      • label_out_component
      • vertex_percolation
      • edge_percolation
      • kcore_decomposition
      • is_bipartite
      • is_DAG
      • is_planar
      • make_maximal_planar
      • edge_reciprocity
      • tsp_tour
      • sequential_vertex_coloring
    • graph_tool.util
      • find_vertex
      • find_vertex_range
      • find_edge
      • find_edge_range
  • The gt file format
  • FAQ

Indices

  • General Index
  • Python Module Index
  • .md

Cookbook guides

Cookbook guides#

Contents:

  • Inferring modular network structure
  • Background: Nonparametric statistical inference
    • Minimum description length (MDL)
  • The stochastic block model (SBM)
    • The nested stochastic block model
  • Inferring the best partition
    • Hierarchical partitions
    • Refinements using merge-split MCMC
  • Model selection
  • Sampling from the posterior distribution
    • Hierarchical partitions
    • Characterizing the posterior distribution
  • Model class selection
  • Edge weights and covariates
    • Model selection
    • Posterior sampling
  • Layered networks
  • Assortative community structure
  • Ordered community structure
  • References
  • Uncertain network reconstruction
    • Measured networks
      • Heterogeneous errors
    • Extraneous error estimates
    • Latent Poisson multigraphs
    • Latent triadic closures
  • Edge prediction as binary classification
  • References
  • Network reconstruction from dynamics and behavior
    • Reconstruction with synthetic data
      • \(L_1\) regularization
    • Reconstruction with empirical data
    • References
  • Animations with graph-tool
    • Simple interactive animations
    • SIRS epidemics
    • Dynamic layout
    • Interactive visualizations
  • Integration with matplotlib
    • Integration with basemap
  • Writing extensions in C++
    • Range-based iteration over vertices and edges
    • Extracting specific property maps
    • Checked and unchecked property maps
    • References

previous

Parallel algorithms

next

Inferring modular network structure

By Tiago de Paula Peixoto

© Copyright 2006-2025, Tiago de Paula Peixoto <tiago@skewed.de>.

Last updated on Apr 16, 2025.