diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index de4d3f7..0000000 --- a/.coveragerc +++ /dev/null @@ -1,9 +0,0 @@ -[run] -omit = src/codegen/* - -[report] -exclude_lines = - pragma: no cover - if TYPE_CHECKING: - ^\s*\.\.\.$ - raise NotImplementedError diff --git a/.git_archival.json b/.git_archival.json deleted file mode 100644 index 9869b59..0000000 --- a/.git_archival.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "hash-full": "$Format:%H$", - "hash-short": "$Format:%h$", - "timestamp": "$Format:%cI$", - "refs": "$Format:%D$", - "describe": "$Format:%(describe:tags=true,match=[0-9]*)$" -} diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5666918..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -.git_archival.json export-subst diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 9c320ba..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: docs - -on: - push: - branches: - - master - - main - -permissions: - contents: write - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v3 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - run: > - pip install mkdocs-material 'mkdocstrings[python]' - - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e4db271..0000000 --- a/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -.env -.coverage -.pytest_cache -.tags -*.pyc -*.pyo -*.swp -build/ -dist/ -htmlcov/ -src/igraph_ctypes/_version.py -tmp/ -.venv/ -.vscode/ -__pycache__/ diff --git a/src/codegen/__init__.py b/.nojekyll similarity index 100% rename from src/codegen/__init__.py rename to .nojekyll diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 2b88275..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -fail_fast: true -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: end-of-file-fixer - - id: trailing-whitespace - - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.3.5 - hooks: - - id: ruff - args: [--fix, --exit-non-zero-on-fix] - - id: ruff-format diff --git a/404.html b/404.html new file mode 100644 index 0000000..3f16461 --- /dev/null +++ b/404.html @@ -0,0 +1,663 @@ + + + +
+ + + + + + + + + + + + + + + + + +igraph_ctypes.constructors modulecreate_empty_graph(n=0, directed=False)
+
+Creates an empty graph with the given number of vertices.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ n
+ |
+
+ int
+ |
+
+
+
+ the number of vertices + |
+
+ 0
+ |
+
+ directed
+ |
+
+ bool
+ |
+
+
+
+ whether the graph is directed + |
+
+ False
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ Graph
+ |
+
+
+
+ the newly created graph + |
+
create_famous_graph(name)
+
+Creates one of the "famous" graphs embedded into igraph by name.
+See the documentation of the igraph_famous() function in igraph's C core
+for a list of names accepted by this function.
Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ name
+ |
+
+ str
+ |
+
+
+
+ the name of the graph to construct + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Graph
+ |
+
+
+
+ the constructed graph + |
+
create_full_graph(n, directed=False, loops=False)
+
+Creates a full graph with the given number of vertices.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ n
+ |
+
+ int
+ |
+
+
+
+ the number of vertices + |
+ + required + | +
+ directed
+ |
+
+ bool
+ |
+
+
+
+ whether the graph is directed + |
+
+ False
+ |
+
+ loops
+ |
+
+ bool
+ |
+
+
+
+ whether each vertex should also have a loop edge + |
+
+ False
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ Graph
+ |
+
+
+
+ the newly created graph + |
+
create_geometric_random_graph(n, radius, torus=False)
+
+Creates a geometric random graph.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ n
+ |
+
+ int
+ |
+
+
+
+ the number of vertices in the graph + |
+ + required + | +
+ radius
+ |
+
+ float
+ |
+
+
+
+ connection distance; two vertices will be connected if they are +closer to each other than this threshold + |
+ + required + | +
create_graph_from_edge_list(edges, n=0, directed=True)
+
+Creates a graph from the given edge list.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ edges
+ |
+
+ Iterable[int]
+ |
+
+
+
+ the list of edges in the graph + |
+ + required + | +
+ n
+ |
+
+ int
+ |
+
+
+
+ the number of vertices in the graph if it cannot be inferred from +the maximum edge ID in the edge list + |
+
+ 0
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ Graph
+ |
+
+
+
+ the newly created graph + |
+
create_square_lattice(dimvector, nei=1, directed=False, mutual=False, periodic=False)
+
+Creates a square lattice graph.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ dimvector
+ |
+
+ Iterable[int]
+ |
+
+
+
+ number of vertices along each dimension of the lattice + |
+ + required + | +
+ directed
+ |
+
+ bool
+ |
+
+
+
+ whether the generated lattice should be directed + |
+
+ False
+ |
+
+ mutual
+ |
+
+ bool
+ |
+
+
+
+ whether the vertices should be connected in both directions +if the lattice is directed + |
+
+ False
+ |
+
+ periodic
+ |
+
+ Union[bool, Iterable[bool]]
+ |
+
+
+
+ whether the lattice should be periodic along each dimension.
+ |
+
+ False
+ |
+
A graph object.
+ + + + + + + + + + + +attrs
+
+
+ property
+
+
+Provides access to the user-defined attributes of the graph.
+ +eattrs
+
+
+ property
+
+
+Provides access to the user-defined attributes of the edges of the +graph.
+This property is experimental; it might be removed any time.
+ +vattrs
+
+
+ property
+
+
+Provides access to the user-defined attributes of the vertices of the +graph.
+This property is experimental; it might be removed any time.
+ +__init__(*args, _wrap=None, **kwds)
+
+Constructor.
+Creates an empty graph. All positional and keyword arguments are
+forwarded to create_empty_graph(), except _wrap, which may be used
+to let the graph take the ownership of a low-level ctypes wrapper object
+for an igraph graph. Typically you will not need to use _wrap.
add_vertices(n)
+
+Adds new vertices to the graph.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ n
+ |
+
+ int
+ |
+
+
+
+ the number of vertices to add + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ C
+ |
+
+
+
+ the graph itself + |
+
convert_to_directed(mode='mutual')
+
+Converts the graph in-place to a directed graph if it is undirected.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ mode
+ |
+
+ Literal['arbitrary', 'mutual', 'random', 'acyclic']
+ |
+
+
+
+ specifies how to convert the graph to directed.
+ |
+
+ 'mutual'
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ C
+ |
+
+
+
+ the graph itself + |
+
convert_to_undirected(mode='collapse', edge_attr_comb=None)
+
+Converts the graph in-place to an undirected graph if it is directed.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ mode
+ |
+
+ Literal['collapse', 'each', 'mutual']
+ |
+
+
+
+ specifies how to convert the graph to undirected.
+`"each |
+
+ 'collapse'
+ |
+
+ edge_attr_comb
+ |
+
+ Optional[AttributeCombinationSpecification]
+ |
+
+
+
+ specifies what to do with the attributes of edges +when multiple edges are collapsed into a single edge during the +conversion process. + |
+
+ None
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ C
+ |
+
+
+
+ the graph itself + |
+
copy()
+
+Creates a copy of the graph.
+The copy will have a vertex and an edge set that is independent from the +original graph. Graph, vertex and edge attributes are copied in a +shallow manner, i.e. the attribute mapping itself is copied but the +values will point to the same objects.
+ + +ecount()
+
+Returns the number of edges in the graph.
+ + +edge(eid)
+
+Returns the endpoints of the edge with the given index from the +graph.
+ + +get_edge_id(from_, to, *, directed=True, error=True)
+
+Returns the ID of an arbitrary edge between the given source and +target vertices.
+ + +is_directed()
+
+Returns whether the graph is directed.
+ + +neighbors(vid, mode=NeighborMode.ALL)
+
+Returns the list of neighbors of a vertex.
+ + +vcount()
+
+Returns the number of vertices in the graph.
+ + +igraph_ctypes.io modulewrite_graph_edgelist(graph, outstream)
+
+Writes the graph in plain edge list format to an output stream.
+The plain edge list format records the structure of the graph only and the +vertices of the graph will be referred to as numeric vertex IDs instead of +vertex names.
+See write_graph_ncol() if you have vertex names and you want to use them
+in the output file instead of IDs.
Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph to write + |
+ + required + | +
+ outstream
+ |
+
+ FileLike
+ |
+
+
+
+ the output file or stream to write the graph to. May be a +filename, a path-like object or a file-like object if it is backed +by a low-level file handle + |
+ + required + | +
write_graph_graphml(graph, outstream, prefixattr=True)
+
+Writes the graph in GraphML format to an output stream.
+The GraphML format preserves numeric, string and boolean attributes.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph to write + |
+ + required + | +
+ outstream
+ |
+
+ FileLike
+ |
+
+
+
+ the output file or stream to write the graph to. May be a +filename, a path-like object or a file-like object if it is backed +by a low-level file handle + |
+ + required + | +
+ prefixattr
+ |
+
+ bool
+ |
+
+
+
+ whether to put a prefix in front of the attribute names to +ensure uniqueness if the graph has vertex and edge (or graph) +attributes with the same name + |
+
+ True
+ |
+
write_graph_lgl(graph, outstream, names='name', weights='weight', isolates=True)
+
+Writes the graph in the LGL (Large Graph Layout) format to an output stream.
+The LGL format can store the structure of a graph with named vertices and +weighted edges.
+Note that the file format does not store whether the graph is directed or not; +this information has to be supplied when the graph is read back.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph to write + |
+ + required + | +
+ outstream
+ |
+
+ FileLike
+ |
+
+
+
+ the output file or stream to write the graph to. May be a +filename, a path-like object or a file-like object if it is backed +by a low-level file handle + |
+ + required + | +
+ names
+ |
+
+ str
+ |
+
+
+
+ name of the string vertex attribute that stores the names of the +vertices to be written into the output file. A warning will be thrown if +the attribute does not exist or is not a string attribute, and the file +will contain numeric vertex IDs instead if this is the case. + |
+
+ 'name'
+ |
+
+ weights
+ |
+
+ str
+ |
+
+
+
+ name of the edge attribute that stores the weights of the edges +to be written into the output file. A warning will be thrown if the +attribute does not exist or is not a numeric attribute, and all weights +will be assumed to be equal to 1 if this is the case. + |
+
+ 'weight'
+ |
+
+ isolates
+ |
+
+ bool
+ |
+
+
+
+ whether to save isolated vertices to the output + |
+
+ True
+ |
+
write_graph_ncol(graph, outstream, names='name', weights='weight')
+
+Writes the graph in the NCOL format to an output stream.
+The NCOL format is essentially a two- or three-column named edge list format. +Each line in the output corresponds to an edge. The first two columns contain +the names of the source and target vertices of an edge. THe third column +(if exists) contains the weight of each edge.
+Note that the file format does not store whether the graph is directed or not; +this information has to be supplied when the graph is read back.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph to write + |
+ + required + | +
+ outstream
+ |
+
+ FileLike
+ |
+
+
+
+ the output file or stream to write the graph to. May be a +filename, a path-like object or a file-like object if it is backed +by a low-level file handle + |
+ + required + | +
+ names
+ |
+
+ str
+ |
+
+
+
+ name of the string vertex attribute that stores the names of the +vertices to be written into the output file. A warning will be thrown if +the attribute does not exist or is not a string attribute, and the file +will contain numeric vertex IDs instead if this is the case. + |
+
+ 'name'
+ |
+
+ weights
+ |
+
+ str
+ |
+
+
+
+ name of the edge attribute that stores the weights of the edges +to be written into the output file. A warning will be thrown if the +attribute does not exist or is not a numeric attribute, and all weights +will be assumed to be equal to 1 if this is the case. + |
+
+ 'weight'
+ |
+
igraph_ctypes.paths moduleFunctions related to shortest or widest paths in a graph.
+ + + + + + + + + + +components(graph, mode=Connectedness.WEAK)
+
+Finds the weakly or strongly connected components of a graph.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph + |
+ + required + | +
+ mode
+ |
+
+ Connectedness
+ |
+
+
+
+ whether the function should return weakly or strongly connected +components + |
+
+ WEAK
+ |
+
shortest_path(graph, source, target, mode=NeighborMode.OUT, weights=None, method='dijkstra')
+
+Finds a single shortest path between two vertices in a graph.
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ graph
+ |
+
+ Graph
+ |
+
+
+
+ the graph + |
+ + required + | +
+ source
+ |
+
+ VertexLike
+ |
+
+
+
+ the source vertex + |
+ + required + | +
+ target
+ |
+
+ VertexLike
+ |
+
+
+
+ the target vertex + |
+ + required + | +
+ mode
+ |
+
+ NeighborMode
+ |
+
+
+
+ TODO + |
+
+ OUT
+ |
+
+ weights
+ |
+
+ Optional[Iterable[float]]
+ |
+
+
+
+ list of weights for each edge in the graph, or |
+
+ None
+ |
+
+ method
+ |
+
+ Literal['auto', 'dijkstra', 'bellman_ford']
+ |
+
+
+
+ the method to use for finding shortest paths when the graph is
+weighted. May be one of |
+
+ 'dijkstra'
+ |
+
Returns:
+| Type | +Description | +
|---|---|
+ IntArray
+ |
+
+
+
+ the IDs of the vertices along the shortest path + |
+
igraph_ctypes.types moduleAttributeCombinationSpecification = Mapping[str | None, AttributeCombinationSpecificationEntry] | AttributeCombinationSpecificationEntry
+
+
+ module-attribute
+
+
+Type alias for mappings that specify how to merge vertex or edge attributes +during an operation that contracts multiple vertices or edge into a single one.
+None specifies the default behaviour.
AttributeCombinationSpecificationEntry = Literal['default', 'ignore', 'sum', 'prod', 'min', 'max', 'random', 'first', 'last', 'mean', 'median', 'concat'] | Callable[[Sequence[Any]], Any]
+
+
+ module-attribute
+
+
+Type alias for values that can be accepted in an AttributeCombinationSpecification_ +mapping.
+ +BoolArray = npt.NDArray[np_type_of_igraph_bool_t]
+
+
+ module-attribute
+
+
+Type alias for NumPy arrays containing igraph booleans
+ +EdgeLike = int
+
+
+ module-attribute
+
+
+Type alias for Python types that can be converted to an igraph edge ID
+ +EdgeSelector = Iterable[EdgeLike] | Literal['all'] | EdgeLike | None
+
+
+ module-attribute
+
+
+Type alias for Python types that can be converted to an igraph edge +selector.
+ +FileLike = int | bytes | str | PathLike[bytes] | PathLike[str] | IOBase
+
+
+ module-attribute
+
+
+Type alias for Python types that can be used in places where the C core +expects a FILE* pointer.
+ +IntArray = npt.NDArray[np_type_of_igraph_int_t]
+
+
+ module-attribute
+
+
+Type alias for NumPy arrays containing igraph integers
+ +RealArray = npt.NDArray[np_type_of_igraph_real_t]
+
+
+ module-attribute
+
+
+Type alias for NumPy arrays containing igraph reals
+ +VertexLike = int
+
+
+ module-attribute
+
+
+Type alias for Python types that can be converted to an igraph vertex ID
+ +VertexPair = tuple[VertexLike, VertexLike]
+
+
+ module-attribute
+
+
+A pair of objects that can both be converted into igraph vertex IDs
+ +VertexSelector = Iterable[VertexLike] | Literal['all'] | VertexLike | None
+
+
+ module-attribute
+
+
+Type alias for Python types that can be converted to an igraph vertex +selector.
+ +0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return i}function B(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o