graph:branch
List of: Scheme Extensions
Subjects: Graph Theory
Contents: Kernel

Action: Returns a subgraph of the given input graph.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:branch in-graph in-trunk


which-branch [keep-trunk=#f])

Arg Types: in-graph graph

in-trunk graph

which-branch integer

keep-trunk boolean

Returns: graph

Description: This command returns a subgraph of the given in-graph that is made up of all the branches that are connected to a given vertex in the ordered in-trunk graph.


in-graph specifies a graph.


in-trunk specifies a graph showing all the connections to a given vertex.


which-branch is an integer signifying the vertex to be used.


The keep-trunk is an option to keep (#t) or not keep (#f) the vertex from the trunk.

Limitations: The in-trunk must be a linear ordered subgraph of the in-graph. The which-branch must be a nonnegative integer less than the max order of the trunk.

Example: ; graph:branch

; Create a simple graph.

(define g1 (graph "a-b b-c c-e c-d c-f f-g f-h"))

;; g1

(define g2 (graph "b-c"))

;; g2

(graph:order-from g2 "b")

;; 1

(graph:branch g1 g2 0)

;; #[graph "a"]

(graph:branch g1 g2 0 #t)

;; #[graph "a-b"]

(graph:branch g1 g2 1)

;; #[graph "f-g f-h d e"]

(graph:branch g1 g2 1 #t)

;; #[graph "c-d c-e c-f f-g f-h"]
PDF/KERN/13SCF.PDF
HTM/DATA/KERN/KERN/13SCF/0032.HTM