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

Action: Returns the number of graph vertices that are connected with graph edges to the specified vertex.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:degree? in-graph in-vertex)

Arg Types: in-graph graph

in-vertex string | entity

Returns: integer

in-graph specifies a graph.

in-vertex could be either the designation name used as part of the graph or the model entity associated with that graph vertex.

Example: ; graph:degree?

; Create a simple example

(define g1 (graph "me-you you-us us-them

them-they me-they


;; g1

; CAREFUL: The order of the graph output may

; not be the same each time.

(graph:degree? g1 "me")

;; 2

(graph:degree? g1 "SPOT")

;; 3

(graph:degree? g1 "PETEY")

;; 1

; Create an example using entities.

(define b1 (solid:block

(position -5 -10 -20) (position 5 10 15)))

;; b1

(define faces1 (entity:faces b1))

;; faces1

; Turn the block faces into vertices of the graph.

(define g3 (graph faces1))

;; g3

(graph:degree? g3 "(Face 0)")

;; 4

(graph:degree? g3 (list-ref faces1 3))

;; 4