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

Action: Decomposes a graph into components that do not have branches.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:split-branches in-graph)

Arg Types: in-graph graph

Returns: graph

Description: This command breaks the branches of a graph into components. It splits the graph into set of subgraphs that are either linear or cyclic with no branches. No edge will belong to more than one subgraph. The union of the subgraphs is the original graph.

in-graph specifies a graph.

Example: ; graph:split-branches;

; Create a simple example

(define block1 (solid:block (position -10 -5 0)

(position 5 10 15)))

;; block1

(define e (entity:edges block1))

;; e

(define v (entity:vertices block1))

;; v

(define g (graph e))

;; g

(define b-list (graph:split-branches g))

;; b-list

(define g0 (list-ref b-list 0))

;; g0

(define g1 (list-ref b-list 1))

;; g1

(define g2 (list-ref b-list 2))

;; g2

(define g3 (list-ref b-list 3))

;; g3

(define g4 (list-ref b-list 4))

;; g4

(define g5 (list-ref b-list 5))

;; g5