Skip to contents

BipartiteGraph(nsrcs, ndsts) builds an empty bipartite graph with nsrcs source vertices (equations) and ndsts destination vertices (variables), as the type of the same name in ModelingToolkit. fadjlist gives the neighbors of each source instead. The result is a mutable object with fields fadjlist (variables of each equation) and badjlist (equations of each variable). asgraph() builds one from a system.

Usage

BipartiteGraph(nsrcs = 0L, ndsts = 0L, fadjlist = NULL)

Arguments

nsrcs, ndsts

Numbers of source and destination vertices.

fadjlist

A list of integer vectors: the destinations of each source.

Value

An object of class BipartiteGraph.

Examples

g <- BipartiteGraph(fadjlist = list(c(1L, 2L), 2L), ndsts = 3L)
g$fadjlist
#> [[1]]
#> [1] 1 2
#> 
#> [[2]]
#> [1] 2
#> 
g$badjlist
#> [[1]]
#> [1] 1
#> 
#> [[2]]
#> [1] 1 2
#> 
#> [[3]]
#> integer(0)
#>