A dgraph stores an undirected simple graph, including isolated vertices.
Adjacency, lengths and scalar edge attributes are validated together and
sorted together. Zero lengths are edges; absent lengths remain NULL.
Usage
dgraph(adj.list, length.list = NULL, edge.attributes = list())
graph.adjacency(graph, stage = "final")
graph.lengths(graph, stage = "final")
graph.order(graph)
graph.stages(graph)
graph.edge.attribute(graph, name, stage = "final")
graph.edges(graph, stage = "final")Arguments
- adj.list
List of 1-based neighbor vectors, one per vertex.
- length.list
Optional aligned finite nonnegative numeric length lists.
- edge.attributes
Named list of aligned scalar edge-attribute lists.
- graph
A
dgraphobject.- stage
Stored graph stage; defaults to
"final". Missing stages error.- name
Name of a stored edge attribute, for example
"overlap".
Value
dgraph() returns a graph. The accessors return adjacency lists,
length lists (or NULL), an ordered edge data frame, the vertex count,
stage names, or the requested attribute list, respectively. Edge tables
contain integer from < to, optional numeric length, and attributes.
Examples
graph <- dgraph(list(c(3L, 2L), 1L, 1L, integer()),
list(c(0, 2), 2, 0, numeric()))
graph.order(graph)
#> [1] 4
graph.edges(graph)
#> from to length
#> 1 1 2 2
#> 2 1 3 0
graph.stages(graph)
#> [1] "final"
graph.adjacency(graph)
#> [[1]]
#> [1] 2 3
#>
#> [[2]]
#> [1] 1
#>
#> [[3]]
#> [1] 1
#>
#> [[4]]
#> integer(0)
#>
graph.lengths(graph)
#> [[1]]
#> [1] 2 0
#>
#> [[2]]
#> [1] 2
#>
#> [[3]]
#> [1] 0
#>
#> [[4]]
#> numeric(0)
#>