NetworkX
2.1
Install
Tutorial
Reference
Introduction
Graph types
Algorithms
Approximations and Heuristics
Assortativity
Bipartite
Boundary
Bridges
Centrality
Chains
Chordal
Clique
Clustering
Coloring
Communicability
Communities
Components
Connectivity
Cores
Covering
Cycles
Cuts
Directed Acyclic Graphs
networkx.algorithms.dag.ancestors
networkx.algorithms.dag.descendants
networkx.algorithms.dag.topological_sort
networkx.algorithms.dag.lexicographical_topological_sort
networkx.algorithms.dag.is_directed_acyclic_graph
networkx.algorithms.dag.is_aperiodic
networkx.algorithms.dag.transitive_closure
networkx.algorithms.dag.transitive_reduction
networkx.algorithms.dag.antichains
networkx.algorithms.dag.dag_longest_path
networkx.algorithms.dag.dag_longest_path_length
networkx.algorithms.dag.dag_to_branching
Dispersion
Distance Measures
Distance-Regular Graphs
Dominance
Dominating Sets
Efficiency
Eulerian
Flows
Graphical degree sequence
Hierarchy
Hybrid
Isolates
Isomorphism
Link Analysis
Link Prediction
Matching
Minors
Maximal independent set
Operators
Reciprocity
Rich Club
Shortest Paths
Simple Paths
Structural holes
Swap
Tournament
Traversal
Tree
Triads
Vitality
Voronoi cells
Wiener index
Functions
Graph generators
Linear algebra
Converting to and from other data formats
Relabeling nodes
Reading and writing graphs
Drawing
Exceptions
Utilities
Glossary
Developer Guide
Release Log
License
Credits
Citing
Bibliography
Examples
NetworkX
Docs
»
Reference
»
Algorithms
»
Directed Acyclic Graphs
»
networkx.algorithms.dag.ancestors
networkx.algorithms.dag.ancestors
¶
ancestors
(
G
,
source
)
[source]
¶
Return all nodes having a path to
source
in
G
.
Parameters:
G
(
NetworkX DiGraph
) – A directed acyclic graph (DAG)
source
(node in
G
)
Returns:
The ancestors of source in G
Return type:
set()