Skip to content

Commit f2d0e2c

Browse files
committed
feat: added write_graph_lgl() and write_graph_ncol()
1 parent 7ae6496 commit f2d0e2c

27 files changed

+378
-31
lines changed

docs/api/io.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reading and writing graphs
2+
3+
## `igraph_ctypes.io` module
4+
5+
::: igraph_ctypes.io

docs/api/types.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Basic data types
2+
3+
## `igraph_ctypes.types` module
4+
5+
::: igraph_ctypes.types
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
names: name of the string vertex attribute that stores the names of the
2+
vertices to be written into the output file. A warning will be thrown if
3+
the attribute does not exist or is not a string attribute, and the file
4+
will contain numeric vertex IDs instead if this is the case.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
weights: name of the edge attribute that stores the weights of the edges
2+
to be written into the output file. A warning will be thrown if the
3+
attribute does not exist or is not a numeric attribute, and all weights
4+
will be assumed to be equal to 1 if this is the case.

docs/fragments/igraph_write_graph_edgelist.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Writes the graph in plain edge list format to an output stream.
22

3-
THe plain edge list format records the structure of the graph _only_ and the
3+
The plain edge list format records the structure of the graph _only_ and the
44
vertices of the graph will be referred to as numeric vertex IDs instead of
55
vertex names.
66

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Writes the graph in the LGL (Large Graph Layout) format to an output stream.
2+
3+
The LGL format can store the structure of a graph with named vertices and
4+
weighted edges.
5+
6+
Note that the file format does not store whether the graph is directed or not;
7+
this information has to be supplied when the graph is read back.
8+
9+
Parameters:
10+
graph: the graph to write
11+
{% include '_include/write_graph_outstream.txt' %}
12+
{% include '_include/write_graph_names.txt' %}
13+
{% include '_include/write_graph_weights.txt' %}
14+
isolates: whether to save isolated vertices to the output
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Writes the graph in the NCOL format to an output stream.
2+
3+
The NCOL format is essentially a two- or three-column named edge list format.
4+
Each line in the output corresponds to an edge. The first two columns contain
5+
the names of the source and target vertices of an edge. THe third column
6+
(if exists) contains the weight of each edge.
7+
8+
Note that the file format does not store whether the graph is directed or not;
9+
this information has to be supplied when the graph is read back.
10+
11+
Parameters:
12+
graph: the graph to write
13+
{% include '_include/write_graph_outstream.txt' %}
14+
{% include '_include/write_graph_names.txt' %}
15+
{% include '_include/write_graph_weights.txt' %}

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ nav:
55
- Home: index.md
66
- Notes: notes.md
77
- API reference:
8+
- api/types.md
89
- api/graph.md
910
- api/constructors.md
1011
- api/paths.md
12+
- api/io.md
1113

1214
exclude_docs: |
1315
fragments/

src/codegen/internal_lib.py.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ from .types import (
4242
igraph_plfit_result_t,
4343
igraph_rng_t,
4444
igraph_rng_type_t,
45+
igraph_warning_handler_t,
4546
)
4647

4748

@@ -556,5 +557,9 @@ igraph_set_interruption_handler = _lib.igraph_set_interruption_handler
556557
igraph_set_interruption_handler.restype = igraph_interruption_handler_t
557558
igraph_set_interruption_handler.argtypes = [igraph_interruption_handler_t]
558559

560+
igraph_set_warning_handler = _lib.igraph_set_warning_handler
561+
igraph_set_warning_handler.restype = igraph_warning_handler_t
562+
igraph_set_warning_handler.argtypes = [igraph_warning_handler_t]
563+
559564
# The rest of this file is generated by Stimulus
560565

src/codegen/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def main():
325325
"BoolArray",
326326
"EdgeLike",
327327
"EdgeSelector",
328+
"FileLike",
328329
"IntArray",
329330
"RealArray",
330331
"VertexLike",

0 commit comments

Comments
 (0)