Action:
|
Returns the number of the component that a given graph element belongs to.
|
|
Filename:
|
kern/kern_scm/graph_scm.cxx
|
|
Syntax:
|
(graph:which-component in-graph in-object)
|
|
Arg Types:
|
in-graph
|
graph
|
|
in-object
|
string | entity
|
|
Returns:
|
integer
|
|
Description:
|
This extension is useful if the given
in-graph has multiple components. It determines which component a given
in-object is part of and returns its component number. The
graph:component command then creates a new graph from just the elements of a single component.
|
|
|
in-graph specifies a graph.
|
|
|
in-object specifies a component. The component is selected by providing a string which is the name of an element of the component or an entity which is associated with an element of the component.
|
|
Example:
|
; graph:which-component
|
|
; Create a simple example
|
|
(define g1 (graph "me-you us-them
|
|
|
we-they them-they
|
|
|
FIDO-SPOT SPOT-KING SPOT-PETEY"))
|
|
;; g1
|
|
; CAREFUL: The order of the graph output may
|
|
; not be the same each time.
|
|
(graph:components g1)
|
|
;; 3
|
|
(graph:which-component g1 "me")
|
|
;; 2
|
|
(define g2 (graph:component g1 2))
|
|
;; g2
|
|
(define g3 (graph:component g1 "me"))
|
|
;; g3
|