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

Action: Returns a graph containing the input graph elements that are of the specified kind number and specified kind status.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:kind in-graph kind on-off)

Arg Types: in-graph graph

kind integer

on-off boolean

Returns: graph

Description: A graph can have multiple kinds assigned to it. Each kind can have a status of #t or #f.


in-graph specifies a graph.


kind is an integer specifying the type.


on-off specifies the kind status.

Example: ; graph:kind

; Create some simple graphs.

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

;; g

(graph:set-kind g 3 #t "a-b")

;; #[graph "a-b b-c c-d c-e"]

(graph:set-kind g 3 #t "b-c")

;; #[graph "a-b b-c c-d c-e"]

(graph:kind g 0 #f)

;; #[graph "a-b b-c c-d c-e"]

(graph:kind g 3 #f)

;; #[graph "c-d c-e a b"]

(graph:kind g 3 #t)

; *** Error graph:kind: A bad edge was added

; to a graph

;; #f

(graph:kind? g 3 "a-b")

;; #t

(graph:kind? g 2 "a-b")

;; #f

(graph:kind? g 3 "b-c")

;; #t

(graph:kind? g 3 "c-e")

;; #f


; Create a selective boolean example.

(define blank (solid:block (position 0 0 0)


(position 25 10 10)))

;; blank

(define b2 (solid:block (position 5 0 0)


(position 10 5 10)))

;; b2

(define b3 (solid:block (position 15 0 0)


(position 20 5 10)))

;; b3

(define subtract1 (solid:subtract blank b2))

;; subtract1

(define subtract2 (solid:subtract blank b3))

;; subtract2

(define tool (solid:cylinder


(position -5 2.5 5) (position 30 2.5 5)1))

;; tool

(define g (bool:select1 blank tool))

;; g

(define p (graph:kind g 0 #t))

;; p

(entity:set-color (graph:entities p) 6)

;; ()
PDF/KERN/13SCF.PDF
HTM/DATA/KERN/KERN/13SCF/0050.HTM