Last active
July 5, 2023 20:38
-
-
Save kenwebb/346f8fc1ab75a1a43450b4561967b171 to your computer and use it in GitHub Desktop.
CtXh bplex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Wed Jul 05 2023 16:37:52 GMT-0400 (GMT-04:00)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
What is the Category?Xholon | |
------ | |
Title: CtXh bplex | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 346f8fc1ab75a1a43450b4561967b171 | |
Keywords: | |
My Notes | |
-------- | |
4 July 2023 | |
### bplex | |
"bplex" is my name for a structure that can be used in Xholon apps. | |
A bplex is a chain or cycle of links between nodes, where each link has the same port name. | |
Nodes A B C partipate in bplex Platypus if | |
- A has a port called Platypus that links to B, and | |
- B has a port called Platypus that links to C, and | |
- C optionally? has a port called Platypus that links to A. | |
I have used this in the Island Game app to connect a Stick, Vine, and Thorn into a Fishing Rod. | |
- the three nodes become a Fishing Rod by virtue of sharing this bplex. | |
- this is instead of enclosing the three nodes by a FishingRod node. | |
- When a fish bytes on the Thorn, the Thorn sends a message along the frod bplex, and | |
eventually some node intercepts the continuous message and performs a frod action. | |
In the Island Game, this active object is the Castaway Avatar. | |
TODO | |
- how can I describe this structure mathematically? | |
- what existing math structure does it resemble? | |
###Math, Category Theory | |
- a bplex is a set of arrows | |
- can be expressed as a set of pairs | |
- ex: ["A,B", "B,C", "C,A"] | |
###Graphviz | |
/* | |
Automatically generated by Xholon version 0.9.1, using org.primordion.ef.Xholon2Graphviz.java | |
Tue Jul 04 11:54:34 GMT-400 2023 1688486074752 | |
model: CtXh bplex | |
www.primordion.com/Xholon | |
To view this file, use Graphviz dot|fdp|neato|twopi|circo|sfdp from http://www.graphviz.org/ | |
For example, to generate an SVG file: | |
dot -Tsvg -O Block_46_1688486074752.gv | |
Alternatively try one of these: | |
dot -Tsvg -O Block_46_1688486074752.gv | |
dot -Tsvg -O -Grankdir=LR Block_46_1688486074752.gv | |
fdp -Tsvg -O Block_46_1688486074752.gv | |
neato -Tsvg -O Block_46_1688486074752.gv | |
circo -Tsvg -O Block_46_1688486074752.gv | |
Or use one of: -Tgif -Tjpg -Tpdf -Tpng -Txdot -Txlib | |
See also: http://www.webgraphviz.com/ | |
See also: http://rise4fun.com/agl/ | |
To repeat this Xholon export: | |
$wnd.xh.xport("Graphviz", $wnd.xh.root().parent().xpath("Chameleon/PhysicalSystem/Block"), '{"gvFileExt":".gv","gvGraph":"digraph","layout":"dot","edgeOp":"->","gvCluster":"","shouldShowStateMachineEntities":false,"filter":"--Behavior,Script","nameTemplateNodeId":"^^^^i^","nameTemplateNodeLabel":"R^^^^^","shouldQuoteLabels":true,"shouldShowLinks":true,"shouldShowLinkLabels":true,"shouldSpecifyLayout":true,"maxLabelLen":-1,"shouldColor":true,"defaultNodeColor":"#f0f8ff","bgGraphColor":"white","shouldSpecifyShape":true,"shape":"box","shouldSpecifySize":false,"size":"6","shouldSpecifyFontname":true,"fontname":"\"Courier New\"","shouldSpecifyArrowhead":true,"arrowhead":"vee","shouldSpecifyStylesheet":true,"stylesheet":"Xholon.css","shouldSpecifyRankdir":false,"rankdir":"LR","shouldDisplayGraph":true,"outputFormat":"svg"}'); | |
*/ | |
digraph 46 { | |
graph [label="Block",id="Block",layout=dot,stylesheet="Xholon.css",fontname="Courier New",bgcolor=white] | |
node [style=filled,fillcolor="#f0f8ff",shape=box,fontname="Courier New"] | |
edge [arrowhead=vee] | |
47 [label="Stick" id="Block/Stick"] | |
47 -> 48 [label="frod"]; | |
48 [label="Vine" id="Block/Vine"] | |
48 -> 49 [label="frod"]; | |
49 [label="Thorn" id="Block/Thorn"] | |
49 -> 47 [label="frod"]; | |
} | |
Graphviz | |
block_46 | |
{"gvFileExt":".gv","gvGraph":"digraph","layout":"dot","edgeOp":"->","gvCluster":"","shouldShowStateMachineEntities":false,"filter":"--Behavior,Script","nameTemplateNodeId":"^^^^i^","nameTemplateNodeLabel":"R^^^^^","shouldQuoteLabels":true,"shouldShowLinks":true,"shouldShowLinkLabels":true,"shouldSpecifyLayout":true,"maxLabelLen":-1,"shouldColor":true,"defaultNodeColor":"#f0f8ff","bgGraphColor":"white","shouldSpecifyShape":true,"shape":"box","shouldSpecifySize":false,"size":"6","shouldSpecifyFontname":true,"fontname":"\"Courier New\"","shouldSpecifyArrowhead":true,"arrowhead":"vee","shouldSpecifyStylesheet":true,"stylesheet":"Xholon.css","shouldSpecifyRankdir":false,"rankdir":"LR","shouldDisplayGraph":true,"outputFormat":"svg"} | |
###Using bplex to represent a Hypergraph? | |
Let nodes be a set of Node objects {a,b,c,d,e,f,g,h,i,j} | |
Let containers be a set of Container objects {r,s,t} | |
Node objects are inside Containers as follows: | |
r: a,b,c | |
s: a,c,d,e,f | |
t: a,e,f,g,h,i,j | |
Instead of representing r,s,t as actual nodes, represent them as 3 bplexes | |
r = a->b->c | |
s = a->c->d->e->f | |
t = a->e->f->g->h->i->j | |
r,s,t arrows could be shown using three different colors | |
TODO: | |
- draw this example using Graphviz | |
###options | |
- array or linked list | |
- chain or cycle | |
- singly-linked or doubly-linked | |
- Set or Array | |
unordered or ordered | |
###Category | |
What is the Category? | |
In Dev Tools, I can get the Stick node as temp0. | |
I can then do: | |
temp0.frod.frod.frod == temp0 | |
RESULT: true | |
or: | |
temp0["frod"]["frod"]["frod"] == temp0 | |
or I could compose these using JS compose: | |
((node) => { | |
console.log(node.name()) | |
const compose = (...fns) => x => fns.reduceRight((y, f) => f(y), x) | |
const funk = node => node.frod | |
const one = compose(funk)(node) | |
console.log(one.name()) | |
const two = compose(funk,funk)(node) | |
console.log(two.name()) | |
const three = compose(funk,funk,funk)(node) | |
console.log(three.name()) | |
})(temp0) | |
###bplex is used in grid ? | |
- Xholon grids use a bplex to connect a sequence of rows, | |
and bplexes to connect the cells in each row | |
- both forward and backward | |
- and these optionally wrap around | |
- so maybe a "bplex" is a generalization of this idea? | |
###Generalized bplex | |
- any sequence of nodes connected in sequence by arrows with the same name | |
- or by arrwos that are the same function or relation? | |
- typically, not following edges that already exist in the base tree | |
- as a minimum, there are at least two links in the sequence ? | |
- BUT, for generality, there could be 1 or 0 | |
###Convert Xholon Tree into a bplex | |
- visit each node, and/or work through a in|pre|post|etc-order traversal | |
- all nodes are now in an array | |
- go through all nodes in the array | |
- convert each parent+next node into a link to next named after the parent | |
- the link/port name shoud be the result of calling parent.name() | |
- ex: if this node is a "Room" and parent is a "House", then the bplex port name might be "house_37" _ | |
- set the parent and next nodes to null | |
- nodes would retain their Xholon id | |
- this is not a particularly good representation | |
- nodes and parents would now have a hard time locating each other | |
- my conclusion: | |
- a bplex is a useful tool under certain circumstances, but not for capturing the entire system structure | |
- it's useful as an adjunct/additional way of connecting things | |
- a type of link graph, or a way of thinking about individual link graphs | |
###Is a bplex a port graph? | |
- maybe ? | |
###Recall the concept of Place Graph and Link Graph | |
- from Milner | |
- a bplex is probably only useful in the context of Link Graph | |
References | |
---------- | |
(1) search: port graph | |
(2) https://math.stackexchange.com/questions/1118344/what-is-the-name-of-a-graph-structure-with-ports#2597225 | |
What is the name of a graph structure with 'ports'? | |
- has some good examples and responses | |
(3) https://scholar.google.com/scholar?q=%22port+graph%22 | |
(4) Labelled Port Graph – A Formal Structure for Models and Computations, Maribel Fernandez, Helene Kirchner, Bruno Pinaud | |
- I downloaded this | |
(5) https://porgy.labri.fr/ | |
PORGY | |
The visual graph rewriting platform | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<Block/> | |
<Stick/> | |
<Vine/> | |
<Thorn/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<Stick> | |
<port name="frod" connector="../Vine"/> | |
</Stick> | |
<Vine> | |
<port name="frod" connector="../Thorn"/> | |
</Vine> | |
<Thorn> | |
<port name="frod" connector="../Stick"/> | |
</Thorn> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<Block> | |
<Stick/> | |
<Vine/> | |
<Thorn/> | |
</Block> | |
</PhysicalSystem> | |
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var a = 123; | |
var b = 456; | |
var c = a * b; | |
if (console) { | |
console.log(c); | |
} | |
//# sourceURL=Blockbehavior.js | |
]]></Blockbehavior> | |
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var myHeight, testing; | |
var beh = { | |
postConfigure: function() { | |
testing = Math.floor(Math.random() * 10); | |
myHeight = this.cnode.parent(); | |
}, | |
act: function() { | |
myHeight.println(this.toString()); | |
}, | |
toString: function() { | |
return "testing:" + testing; | |
} | |
} | |
//# sourceURL=Heightbehavior.js | |
]]></Heightbehavior> | |
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
$wnd.xh.Brickbehavior = function Brickbehavior() {} | |
$wnd.xh.Brickbehavior.prototype.postConfigure = function() { | |
this.brick = this.cnode.parent(); | |
this.iam = " red brick"; | |
}; | |
$wnd.xh.Brickbehavior.prototype.act = function() { | |
this.brick.println("I am a" + this.iam); | |
}; | |
//# sourceURL=Brickbehavior.js | |
]]></Brickbehavior> | |
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
console.log("I'm another brick behavior"); | |
]]></Brickbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Block</title> | |
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Stick</title> | |
<rect id="PhysicalSystem/Block/Stick" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</g> | |
</svg> | |
<!--?xml version="1.0" encoding="UTF-8" standalone="no"?--> | |
<!--?xml-stylesheet href="Xholon.css" type="text/css"?--> | |
<!-- Generated by graphviz version 2.28.0 (20140111.2315) | |
--> | |
<!-- Title: 46 Pages: 1 --> | |
<svg width="111pt" height="249pt" viewBox="0.00 0.00 111.32 248.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<g id="Block" class="graph" transform="scale(1 1) rotate(0) translate(4 244.8)"> | |
<title>46</title> | |
<polygon fill="white" stroke="none" points="-4,4 -4,-244.8 107.321,-244.8 107.321,4 -4,4"></polygon> | |
<text text-anchor="middle" x="51.6606" y="-8.2" font-family="Courier New" font-size="14.00">Block</text> | |
<!-- 47 --> | |
<g id="Block/Stick" class="node"><title>47</title> | |
<polygon fill="#f0f8ff" stroke="black" points="98.4948,-240.8 41.5052,-240.8 41.5052,-204.8 98.4948,-204.8 98.4948,-240.8"></polygon> | |
<text text-anchor="middle" x="70" y="-218.6" font-family="Courier New" font-size="14.00">Stick</text> | |
</g> | |
<!-- 48 --> | |
<g id="Block/Vine" class="node"><title>48</title> | |
<polygon fill="#f0f8ff" stroke="black" points="54,-150.8 0,-150.8 0,-114.8 54,-114.8 54,-150.8"></polygon> | |
<text text-anchor="middle" x="27" y="-128.6" font-family="Courier New" font-size="14.00">Vine</text> | |
</g> | |
<!-- 47->48 --> | |
<g id="Block_edge1" class="edge"><title>47->48</title> | |
<path fill="none" stroke="black" d="M61.5137,-204.724C58.6926,-199.029 55.5412,-192.645 52.6788,-186.8 48.4316,-178.127 43.8228,-168.639 39.6975,-160.118"></path> | |
<polygon fill="black" stroke="black" points="35.2902,-151.003 43.6948,-158.047 37.4669,-155.505 39.6435,-160.006 39.6435,-160.006 39.6435,-160.006 37.4669,-155.505 35.5923,-161.965 35.2902,-151.003 35.2902,-151.003"></polygon> | |
<text text-anchor="middle" x="63.6606" y="-173.6" font-family="Times,serif" font-size="14.00">frod</text> | |
</g> | |
<!-- 49 --> | |
<g id="Block/Thorn" class="node"><title>49</title> | |
<polygon fill="#f0f8ff" stroke="black" points="93.4948,-60.8 36.5052,-60.8 36.5052,-24.8 93.4948,-24.8 93.4948,-60.8"></polygon> | |
<text text-anchor="middle" x="65" y="-38.6" font-family="Courier New" font-size="14.00">Thorn</text> | |
</g> | |
<!-- 48->49 --> | |
<g id="Block_edge2" class="edge"><title>48->49</title> | |
<path fill="none" stroke="black" d="M34.5076,-114.414C39.9555,-101.798 47.4227,-84.5052 53.604,-70.1907"></path> | |
<polygon fill="black" stroke="black" points="57.6373,-60.8504 57.8042,-71.815 55.6551,-65.4407 53.6729,-70.031 53.6729,-70.031 53.6729,-70.031 55.6551,-65.4407 49.5416,-68.2471 57.6373,-60.8504 57.6373,-60.8504"></polygon> | |
<text text-anchor="middle" x="61.6606" y="-83.6" font-family="Times,serif" font-size="14.00">frod</text> | |
</g> | |
<!-- 49->47 --> | |
<g id="Block_edge3" class="edge"><title>49->47</title> | |
<path fill="none" stroke="black" d="M71.5489,-60.9991C73.3676,-66.5911 75.0919,-72.882 76,-78.8 83.2801,-126.245 80.0698,-138.973 76,-186.8 75.7805,-189.38 75.4715,-192.055 75.1083,-194.726"></path> | |
<polygon fill="black" stroke="black" points="73.5135,-204.785 70.6349,-194.204 74.2965,-199.847 75.0794,-194.908 75.0794,-194.908 75.0794,-194.908 74.2965,-199.847 79.5239,-195.613 73.5135,-204.785 73.5135,-204.785"></polygon> | |
<text text-anchor="middle" x="91.6606" y="-128.6" font-family="Times,serif" font-size="14.00">frod</text> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment