Action:

Creates a subgraph from a given graph using either two integers or a law.


Filename:

kern/kern_scm/graph_scm.cxx


Syntax:

(graph:subset ingraph {subsetlaw 



lowbounds upbounds})


Arg Types:

ingraph

graph


subsetlaw

law


lowbounds

integer


upbounds

integer


Returns:

graph


Description:

Given an ordered graph, a subgraph may be formed using one of two techniques. One method takes in two integers and the other takes a law pointer.



ingraph specifies a graph.



subsetlaw specifies a law. This extension with
subsetlaw returns the set of all vertices such that their order evaluates as true along with the all edges that have both of their adjacent vertices evaluating as true orders.



This extension with
lowbounds and
upbounds returns a subgraph in one of two ways.



1.

If
lowbounds<upbounds, then the set of all vertices with orders between
lowbounds and
upbounds is returned along with all edges that have both of their adjacent vertices in this set.


2.

If
upbounds<lowbounds, then the set of all vertices with orders not between
lowbounds and
upbounds is returned along with all edges that have both of their adjacent vertices in this set.


Example:

; graph:subset


; Create a simple graph


(define g1 (graph "ab bc ce cd cf fg fh"))


;; g1


(graph:orderfrom g1 "a")


;; 4


(define g2 (graph:subset g1 1 3))


;; g2


(define g3 (graph:subset g1 "x>2"))


;; g3


(define law1 (law "(x>2)or(x=0)"))


;; law1


(define g4 (graph:subset g1 law1))


;; g4
