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

Action: Returns a list of all the kinds on a vertex or edge.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:kinds? in-graph item1 [item2])

Arg Types: in-graph graph

item1 string | entity

item2 entity

Returns: boolean

Description: Given a graph and a vertex or edge, returns a list containing all kinds on that vertex or edge. A graph can have any number of kind types assigned to edges of the graph. kind is an integer for the type and can take a Boolean value. If not specified, it is assumed to be #f. The assignment of kind and its value is done on a per edge basis.

in-graph specifies a graph.

item1 could be either a string or an entity. When it is a string, it is tested to see whether it represents the name of an edge in the graph or a vertex in the graph.

item2 is only used when item1 is an entity representing a vertex, in which case item2 must also be an entity representing a vertex.

Example: ; graph:kinds?

; 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:kinds? g "a-b")

;; (#f #f #f #t)

(graph:kinds? g "b-c")

;; (#f #f #f #t)

(graph:kinds? g "c-d")

;; ()