#From a question to a tool call
Graph analysis usually proceeds through data inspection, entity resolution, computation, and presentation. Confirm version, direction, and properties with get_graph_info, resolve inputs by exact name or search, execute the algorithm, and then pass its results to visualization or reporting. The model organizes the analysis; Graph Engine supplies computed values.
| Question | Start with | Confirm first |
|---|---|---|
| Which nodes have the most direct connections? | degree_analysis / node_centrality(degree) | Distinguish incoming/outgoing degree, relationship count, and distinct neighbors. |
| Which nodes lie on important paths? | node_centrality(betweenness) | Weights represent distance/cost and satisfy the weight constraints. |
| How are two entities connected? | shortest_path / path_analysis | Specify direction and whether to minimize hops or cost. |
| Which tightly connected groups exist? | community_detection | Confirm undirected projection and connection-strength weights. |
| Where are network bottlenecks? | maximum_flow / minimum_cut | Capacity units, source, sink, and parallel relationships. |
| Which possible links merit investigation? | link_prediction_score | Structural scores rank candidates; they do not establish existing relationships. |
Independent algorithms in one model response may run concurrently, but a step needing actual output must wait. Do not guess a node ID for shortest_path before search_node returns. Before clearing, replacing, or saving a subgraph, check whether the tool changes the active graph.
#Shortest paths and path enumeration
shortest_path with use_weight=true minimizes total edge weight; false minimizes hop count. These are different objectives. Weighted paths use NetworkX shortest-path routines, and all-target single-source requests use Dijkstra. Unweighted paths traverse by hops. A missing path is a valid query outcome represented by found=false, not necessarily a service failure.
A -> B : 2
A -> C : 5
B -> C : 1
B -> D : 4
C -> D : 1
Weighted minimum: A -> B -> C -> D, cost = 4, hops = 3
Minimum hops: A -> B -> D or A -> C -> D, hops = 2algorithm=yen_k_shortest returns several simple paths ordered by cost, possibly with different costs. all_shortest_paths returns paths tied at the optimal cost. path_analysis(method=all_simple_paths) enumerates simple paths within cutoff, potentially including many nonoptimal routes. Simple paths do not revisit nodes, unlike general walks.
target="all" computes single-source reachability and paths, showing the nearest 10 by default alongside reachable_count and distance statistics. all_shortest_paths also displays up to 10 by default. Display counts are not total reachable nodes or total shortest paths; inspect truncated and count_returned.
Property-graph parallel edges use minimum-weight projection and paths are distinguished by node sequence. Multiple equivalent relationships along one node sequence do not automatically create different returned paths. Some NebulaGraph tools load a bounded hop neighborhood, where a missing path only describes that scope.
#Centrality: different notions of importance
Centralities do not share one definition of importance. Degree counts direct connectivity, betweenness emphasizes mediation along shortest paths, and PageRank considers links from other important nodes. State the question and edge direction before interpreting rankings; scores from different centralities do not share a common scale.
| Enum / name | Meaning | Implementation details |
|---|---|---|
| degree | Degree centrality: normalized connectivity. | Does not sum weight strength; use degree_analysis for raw degree counts. |
| betweenness | Betweenness: sum of shortest-path fractions passing through a node. | Uses weight as distance. Property graphs require strictly positive weights; a sampling k is not exposed. |
| closeness | Closeness: inverse average shortest distance from other nodes to the node. | Uses incoming distances in directed graphs with NetworkX reachability scaling. |
| harmonic | Harmonic centrality: sum of reciprocal reachable distances. | Uses weighted distances; unreachable nodes are not zero-distance nodes. |
| pagerank | PageRank: stationary importance propagated along links. | weight represents connection strength; parallel weights are summed. |
| eigenvector | Eigenvector centrality: connectivity to high-scoring nodes raises the score. | Power iteration allows 1,000 iterations, then attempts a NumPy solver on nonconvergence. |
| katz | Katz centrality: attenuated contributions from walks of different lengths. | Fixed alpha=0.1, beta=1.0, max_iter=1000; convergence is not guaranteed. |
| load | Load centrality: load distributed along shortest paths. | Uses weight as distance with strictly positive property-graph weights. |
| voterank | VoteRank: selects influential nodes using a voting process. | Returns ordinal scores for selected nodes, not probabilities for all nodes. |
| percolation | Percolation centrality: path importance weighted by node percolation state. | Reads the percolation node attribute, defaulting to 1.0. |
node_centrality returns top_nodes, bottom_nodes, value_stats, and total_nodes, generally rounded to six decimals. top_nodes defaults to 20, while bottom_nodes avoids overlap with the leading entries. total_nodes counts scored nodes, which need not establish the graph size for methods such as VoteRank.
#Community detection and modularity
Community detection groups densely connected nodes. Graph Engine constructs the algorithm’s undirected analysis graph and computes communities and modularity. Modularity compares within-group connectivity with a random baseline. It compares partitions under the same graph and weight semantics, not predictive accuracy.
| Algorithm | Strategy and weights | Result scope |
|---|---|---|
| louvain | Weighted modularity optimization with seed=42. | Returns a partition from the aggregation process. |
| greedy_modularity | Greedy merges improve weighted modularity. | Partitions the current undirected analysis graph. |
| label_propagation | Label propagation without passing weights in this branch. | Partitioning follows adjacency structure. |
| label_propagation_asyn | Asynchronous weighted label propagation with seed=42. | The configured seed controls stochastic choices. |
| girvan_newman | Progressive splits based on edge betweenness. | Currently returns the generator’s first partition. |
| asyn_fluidc | Asynchronous fluid communities, targeting at most three groups. | Uses only the largest component for disconnected graphs. |
| leiden | Uses python-igraph and leidenalg; the current conversion passes no weights. | Exceptions fall back to weighted Louvain; algorithm still reports the requested value. |
By default, show the five largest communities with ten node previews each. num_communities, communities_shown, communities_truncated, and nodes_truncated distinguish total groups, displayed groups, and both truncation levels. community_id belongs to this computation and is not a stable business identifier across graph versions.
Record graph version, weight usage, undirected projection, and covered nodes when comparing algorithms. Leiden has fallback and weight-transfer limitations, while asyn_fluidc can omit other connected components. These conditions change what the result means.
focus_nodes accepts up to 200 actual node names to associate them with the same community partition rather than IDs from another run. Identical algorithm names do not imply identical implementations across ordinary and large-graph paths: large-graph community analysis currently maps all seven names to scalable weighted synchronous label propagation, with max_iterations=5 by default. Inspect capabilities and consider strict_semantics=true to reject approximate mappings when the named algorithm’s semantics are required.
#Flows, cuts, and spanning trees
Maximum flow treats edge weights as capacities and maximizes flow from source to sink under capacity and conservation constraints. minimum_cut with source/sink finds the minimum-capacity separating cut. Under identical network and capacity conventions, maximum flow and minimum cut have equal values, providing an input-consistency check.
s -> a : 3
s -> b : 2
a -> b : 1
a -> t : 2
b -> t : 3
Feasible flow: s-a-t = 2, s-a-b-t = 1, s-b-t = 2
Maximum flow = 5; a minimum cut is {s} | {a,b,t}, capacity = 5This illustrative network is calculated by hand. maximum_flow returns max_flow_value and nonzero-edge previews; minimum_cut returns min_cut_value, partition sizes, and cut-edge previews. Flow assignments and minimizing partitions may not be unique, so one returned edge set is not necessarily the only bottleneck solution.
global_minimum_cut has no fixed terminals and currently uses undirected Stoer–Wagner. Directed input requires treat_as_undirected=true; pair weights are combined and self-loops do not participate. Disconnected graphs have a cut value of zero. This asks for the easiest global separation rather than a cut between two chosen terminals.
minimum_spanning_tree minimizes total edge weight while connecting nodes without cycles. Disconnected input returns a minimum spanning forest summary. It minimizes total network connection cost, not every source-to-node path; use shortest_path for routing.
Minimum spanning trees use an undirected analysis graph. Constructed attributed graphs select the minimum-weight relationship per unordered endpoint pair. Ordinary directed graphs are converted directly by NetworkX, which does not guarantee choosing the smaller weight between opposite directions. Record the input representation and projection rule when comparing results.
#Structure, subgraphs, and candidate links
Strongly connected components require mutual directed reachability; weak components ignore direction. graph_connectivity reports both. topological_sort requires a directed acyclic graph. When business dependencies contain cycles, inspect find_cycles before deciding how to change relationships.
With a finite display limit, find_cycles streams one more cycle than the limit to detect truncation. Requesting all results enumerates and stores all simple cycles. maximum_cycle searches at most max_cycles candidates for the longest or greatest-weight simple cycle, defaulting to 10,000. search_exhausted=false means the result is only the best candidate examined, not a proven global optimum.
| Subgraph method | Meaning | Usage |
|---|---|---|
| node_subset | Induced subgraph on selected nodes. | Retains existing relationships among those nodes. |
| ego_graph | Expand around a center by radius. | Confirm direction and scope parameters. |
| k_core | Recursively remove nodes with degree below k. | Finds a structure maintaining minimum degree k. |
| k_truss | Subgraph whose edges participate in at least k−2 triangles. | Useful for triangle-dense regions. |
| k_corona | Induced subgraph on nodes with degree exactly k within the k-core. | Not all nodes whose original-graph degree equals k. |
subgraph_extraction defaults to create_version=true and makes the extracted graph active. Pass false explicitly for explanatory previews. Later centrality, community, and training calls read the active graph, so saving a subgraph changes their input; record the new graph_version.
Structural link prediction needs no trained model. Jaccard measures shared neighbors relative to their union; Adamic–Adar and resource allocation discount high-degree common neighbors; preferential attachment multiplies endpoint degrees. Without two endpoints, the tool scores non-edge pairs and retains the best candidates. top_k bounds retained results, not total scoring work.
| Extended tool | Questions and scope |
|---|---|
| graph_structure_analysis | Tree, forest, DAG, bipartite and planarity checks; BFS/DFS trees, topological orders and WL hashing. Traversals require source and do not save a new active graph. |
| connectivity_analysis | Node/edge connectivity, cuts, articulation points, bridges and components. Local connectivity and cuts take source/target together; condensation requires a directed graph. |
| tree_dag_analysis | Maximum/random spanning trees, lowest common ancestors, dominators, DAG longest paths and antichains. LCA needs node1/node2, dominators need source, and DAG methods check their prerequisites. |
| matching_coloring_analysis | Matching, edge covers and coloring on an undirected view. Maximal is distinct from maximum matching; equitable coloring needs num_colors above the maximum degree, and minimum edge cover rejects isolates. |
| distance_measures | Center, periphery, eccentricity, Wiener index, efficiency, reciprocity and more. Center, periphery, eccentricity, Wiener index and barycenter use the largest undirected component; acyclic girth is null with acyclic=true. |
These five groups currently reject multigraphs. Ordinary list previews default to 20 and positive integer limits are capped at 200; the meaning of all depends on the method. All topological orders, antichains, colliders and v-structures retain a hard limit of 200. Read truncated, hard_limit and count_is_exact rather than treating preview length as a total count. The large-graph path has separate capability, budget and artifact constraints. This page documents source contracts, not execution of every algorithm and parameter combination on the current deployment.
#Metrics and output scope
| Metric | Current convention |
|---|---|
| density | Density follows graph direction; self-loops and multiple relationships affect its interpretation. |
| diameter / radius | Convert to undirected, select the largest component, and use unweighted distances. |
| transitivity | Compute global triangle closure on the undirected analysis graph. |
| average_clustering | Compute weighted average clustering on the undirected graph. |
| degree_assortativity | Measure correlation between endpoint degrees on the undirected graph. |
Finite diameter and radius do not establish connectivity of the original directed graph; they may describe only its largest undirected component. Some metrics are undefined on empty graphs or graphs with no degree variation. global_metrics represents nonfinite results with defined=false and value=null. Degree assortativity also includes undefined_reason_code and undefined_reason for no edges or zero endpoint-degree variance. Undefined is neither zero nor evidence that the engine lacks the metric; other input or structural errors can still return success=false.
summary, preview, top_nodes, and truncated describe different levels of output. Global metrics may use the full input graph while lists display only part of it; bounded remote queries can restrict the input itself. Reports should distinguish computation scope from display scope.
The visualize_subgraph catalog defaults are max_nodes=800 and include_community=true. Engine fallback and edge limits are configurable with VISUALIZE_MAX_NODES and VISUALIZE_MAX_EDGES, defaulting to 800 and 2,000. Oversized inputs use deterministic overview selection combining highlights, node types, community representatives, high-degree nodes and connecting paths. Even requested highlights can be truncated; inspect overview.required_nodes_truncated. total_nodes/total_edges describe the original requested scope, while num_nodes/num_edges describe the displayed view. A view cannot establish absence of paths outside it; reports likewise require actual source_results and explicit computation and display scopes.