Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active January 14, 2020 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/b8a7893bc4723388cd6e355069c9fd55 to your computer and use it in GitHub Desktop.
Save kenwebb/b8a7893bc4723388cd6e355069c9fd55 to your computer and use it in GitHub Desktop.
Programming with Categories - Shape - essence of

Programming with Categories

Brendan Fong, Bartosz Milewski, and David Spivak, have just kicked off a new course at MIT called Programming with Categories. I don't live in Boston so I can't attend the course, but I am watching the videos as they come out. In lecture 2 (about time 5:30), Brendan introduces the informal concept of Shape.

I very much like this idea of shapes, where each Shape suggests "the essence of" a basic idea in Category Theory. To me this provides a way to informally use these concepts. I can take this essence and use it in any way that provides some practical value.

This is roughly the table that Brendan presented.

Shape Label Essence Of Objects Arrows
1 object 1 1
P pair 2 2
2 arrow 2 3
I isomorphism 2 4

You can use Graphviz .dot notation to roughly reproduce what Brendan drew on the blackboard.

// Graphviz specification
digraph G {
  subgraph cluster_1 {x1->x1;             label="1 object";}
  subgraph cluster_P {xp->xp yp->yp;      label="P pair";}
  subgraph cluster_2 {x2->x2->y2->y2;     label="2 arrow";}
  subgraph cluster_I {xi->xi->yi->yi->xi; label="I isomorphism";}
}

A number of online sites are able to parse Graphviz .dot notation, and display it as a Scalable Vector Graphics (SVG) image. WebGraphviz is one such site. Copy the above text, paste it into the site, and click Generate Graph!.

The resulting SVG image looks like this:

Figure 1-1

I also like the idea of a probe (about time 48:00).

I like these ideas partly because they help to define a set of experiments I'm working on with Jen, a researcher in Cognitive Science at Carleton University in Ottawa. We are exploring the concept of exploitation, starting from a set of very simple models. We have worked out a basic definition of exploitation. It must involve at least two individual people, engaged in some sort of interaction.

In our model, developed using my software Xholon as an Agent-Based Modeling tool, we start with a simplest possible scenario.

Scenario 1

In this scenario, there is one World that contains one Island on which may live one Fisher (Fisherman). As yet, there are no Fish, so there's not yet much of a living for a Fisher. Basically, there is just an Island, a single object. This scenario implements the shape labeled 1, and suggests the essence of object. There is one object Island and one arrow identity.

Scenario P

There is now a pair of islands, each isolated from the other. There are two objects, and two identity arrows. This scenario implements the shape labeled P, and suggests the essence of pair.

Scenario 2

One island now provides a directed link to the other island, but no return link. This scenario implements the shape labeled 2, and suggests the essence of arrow.

Scenario I

Both islands provide a directed link to the other island. This scenario implements the shape labeled I, and suggests the essence of isomorphism.

Xholon

I have implemented a Graphviz parser and model generator in my own software, based on the ANTLR example DOT grammar. It only runs locally at this point. It generates the following XML from the Graphviz specification, which Xholon then parses into an internal structure of nodes and edges.

<TheSystem>
  <Node roleName="x1">
    <port name="edge" index="0" connector="../Node[@roleName='x1']"/>
  </Node>
  <Node roleName="xp">
    <port name="edge" index="0" connector="../Node[@roleName='xp']"/>
  </Node>
  <Node roleName="yp">
    <port name="edge" index="0" connector="../Node[@roleName='yp']"/>
  </Node>
  <Node roleName="x2">
    <port name="edge" index="0" connector="../Node[@roleName='x2']"/>
    <port name="edge" index="1" connector="../Node[@roleName='y2']"/>
  </Node>
  <Node roleName="y2">
    <port name="edge" index="0" connector="../Node[@roleName='y2']"/>
  </Node>
  <Node roleName="xi">
    <port name="edge" index="0" connector="../Node[@roleName='xi']"/>
    <port name="edge" index="1" connector="../Node[@roleName='yi']"/>
  </Node>
  <Node roleName="yi">
    <port name="edge" index="0" connector="../Node[@roleName='yi']"/>
    <port name="edge" index="1" connector="../Node[@roleName='xi']"/>
  </Node>
</TheSystem>

An Avatar is then able to examine and move through the resulting structure. The Avatar acts as a probe, as described in Brendan's lecture. The Avatar is the single element of a Set, and is able to link to any of the nodes in the Shape set. It can learn about nodes and about the edges emanating from each node. The following is a trace of actions performed ny the Avatar. In this example, the Avatar is controlled directly by a human.

 You are the system Avatar avatar_42.You are in chameleon_0.
 ...
 Moving to theSystem_392
 You are in theSystem_392.
 You see x1:node_394
 You see xp:node_396
 You see yp:node_398
 You see x2:node_400
 You see y2:node_403
 You see xi:node_405
 You see yi:node_408
 Entered x1:node_394
 You are in x1:node_394.
 You see passage edge0 to x1:node_394
 Moving along edge to x1:node_394
 Moving along edge to x1:node_394
 ...
 Moving to xp:node_396
 You are the system Avatar avatar_42.You are in xp:node_396.
 You are in xp:node_396.
 You see passage edge0 to xp:node_396
 Moving along edge to xp:node_396
 Moving along edge to xp:node_396
 ...
 Moving to yp:node_398
 You are in yp:node_398.
 You see passage edge0 to yp:node_398
 Moving along edge to yp:node_398
 Moving along edge to yp:node_398
 ...
 Moving to x2:node_400
 You are in x2:node_400.
 You see passage edge0 to x2:node_400
 You see passage edge1 to y2:node_403
 Moving along edge to x2:node_400
 Moving along edge to x2:node_400
 ...
 Moving along edge to y2:node_403
 You are in y2:node_403.
 You see passage edge0 to y2:node_403
 Moving along edge to y2:node_403
 Moving along edge to y2:node_403
 ...
 You are in y2:node_403.
 You see passage edge0 to y2:node_403
 Moving to xi:node_405
 You are in xi:node_405.
 You see passage edge0 to xi:node_405
 You see passage edge1 to yi:node_408
 Moving along edge to xi:node_405
 Moving along edge to xi:node_405
 ...
 Moving along edge to yi:node_408
 Moving along edge to yi:node_408
 ...
 Moving along edge to xi:node_405
 Moving along edge to yi:node_408
 Moving along edge to yi:node_408
 ...
 Moving along edge to xi:node_405
 Moving along edge to xi:node_405
 ...

Some background on myself

I am a software developer (C, C++, Java, JavaScript, Assembly Language, etc.). In the past few years I have become interested in how to apply ideas from Math and Category Theory for the development of software and for understanding the world around us. A couple of years ago I met with David (and also met Brendan) to discuss some of these connections. I've also benefited from David's book (Category Theory for the Sciences), from Brendan and David's newer book (An Invitation to Applied Category Theory - Seven Sketches in Compositionality), from Bartosz's website (piggies rule!), and from everybody's videos. To understand anything from the Math world, it always works best for me to approach it from a constructive (building and running things/code) perspective.

I'm looking forward to learning some Haskell.

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

In lecture 2 (about time 5:30), Brendan introduces a notion of Shape. I like this idea. Each Shape (object, pair, arrow, isomorphism) suggests the essence of a basic idea in Category Theory. An essence is not formally defined. I can play with it in my own way, with tools I'm familiar with.

This is roughly the table that Brendan presented.

| Shape Label | Essence Of  | Objects | Arrows |
| ----------- | ----------- | ------- | ------ |
| 1           | object      | 1       | 1      |
| P           | pair        | 2       | 2      |
| 2           | arrow       | 2       | 3      |
| I           | isomorphism | 2       | 4      |

Graphviz, can roughly reproduce what Brendan drew on the blackboard. A number of online sites can parse Graphviz .dot notation, and display it as a Scalable Vector Graphics (SVG) image. WebGraphviz is one such site. Copy any of the following four digraph lines, paste it into the WebGraphviz site, click Generate Graph!, and view the SVG image (as shown below).

digraph 1 {x->x; label="1 object";}

Figure 1

digraph P {x->x y->y; label="P pair";}

Figure P

digraph 2 {x->x->y->y; label="2 arrow";}

Figure 2

digraph I {x->x->y->y->x; label="I isomorphism";}

Figure I

I wonder what other essences are lurking out there, or is this as far as we can go with this concept?

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sun Jan 12 2020 19:09:31 GMT-0500 (Eastern Standard Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Programming with Categories - Shape - essence of
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: b8a7893bc4723388cd6e355069c9fd55
Keywords:
My Notes
--------
January 10, 2020
TODO
- DONE add the SVG file to github
- extend the isomorphism (I) model
- add Fisher as Avatar or other JS behavior
- add Ocean and Fish
Azimuth Project [ref 4]
- uses Markdown for forum messages
- also latex with Mathjax
- to include SVG
To include images you can link to an external file using Markdown as follows:
![Title](http://...) ![Title](/path...)
You can also do it using HTML: for example, including this in your comment:
<img src = "http://math.ucr.edu/home/baez/mathematical/7_sketches/exercise_1.2.png">
-
References
----------
(1) http://brendanfong.com/programmingcats.html
Brendan Fong, Bartosz Milewski, and David Spivak, have just kicked off a new course at MIT called Programming with Categories.
Summary:
In this course we explain how category theory—a branch of mathematics known for its ability to organize the key
abstractions that structure much of the mathematical universe—has become useful for writing elegant and maintainable code.
In particular, we'll use examples from the Haskell programming language to motivate category-theoretic constructs,
and then explain these constructs from a more abstract and inclusive viewpoint.
Hands-on programming exercises will be used to demonstrate categorical ideas like "the universal property of products"
in working Haskell code.
(2) https://www.youtube.com/watch?v=jm3bJrULMqM
Programming with Categories - Lecture 2
lecturer - Brendan Fong
(3) http://www.webgraphviz.com/
I used this site to parse the Graphviz .dot notation, and display it as a Scalable Vector Graphics (SVG) image, which I then copied to this Xholon workbook page.
(4) https://forum.azimuthproject.org/
) https://forum.azimuthproject.org/categories/-%20-%20Software
) https://forum.azimuthproject.org/discussion/966/graphviz#latest
) https://www.azimuthproject.org/azimuth/show/Forum+-+Guide
what is the azimuth project, and how to contribute
(5) https://forum.azimuthproject.org/categories/applied-category-theory-course
website for outside participants in the course
]]></Notes>
<markdown><![CDATA[
**Programming with Categories**
Brendan Fong, Bartosz Milewski, and David Spivak, have just kicked off a [new course](http://brendanfong.com/programmingcats.html) at MIT called *Programming with Categories*.
I don't live in Boston so I can't attend the course, but I am watching the videos as they come out.
In [lecture 2](https://www.youtube.com/watch?v=jm3bJrULMqM) (about time 5:30), Brendan introduces the informal concept of **Shape**.
I very much like this idea of shapes, where each Shape suggests "the essence of" a basic idea in Category Theory.
To me this provides a way to informally use these concepts. I can take this _essence_ and use it in any way that provides some practical value.
This is roughly the table that Brendan presented.
Shape Label | Essence Of | Objects | Arrows
----------- | ---------- | ------- | ------
1 | object | 1 | 1
P | pair | 2 | 2
2 | arrow | 2 | 3
I | isomorphism | 2 | 4
You can use [Graphviz](https://graphviz.org/) .dot notation to roughly reproduce what Brendan drew on the blackboard.
```dot
// Graphviz specification
digraph G {
subgraph cluster_1 {x1->x1; label="1 object";}
subgraph cluster_P {xp->xp yp->yp; label="P pair";}
subgraph cluster_2 {x2->x2->y2->y2; label="2 arrow";}
subgraph cluster_I {xi->xi->yi->yi->xi; label="I isomorphism";}
}
```
A number of online sites are able to parse Graphviz .dot notation, and display it as a Scalable Vector Graphics (SVG) image.
[WebGraphviz](http://www.webgraphviz.com/) is one such site. Copy the above text, paste it into the site, and click _Generate Graph!_.
The resulting SVG image looks like this:
![Figure 1-1](https://gist.githubusercontent.com/kenwebb/b8a7893bc4723388cd6e355069c9fd55/raw/e614096f2eca8144c1c41c9066b5f01948deb2c6/Shapes.svg?sanitize=true "Figure 1-1")
I also like the idea of a **probe** (about time 48:00).
I like these ideas partly because they help to define a set of experiments I'm working on with Jen, a researcher in Cognitive Science at Carleton University in Ottawa.
We are exploring the concept of **exploitation**, starting from a set of very simple models.
We have worked out a basic definition of exploitation. It must involve at least two individual people, engaged in some sort of interaction.
In our model, developed using my software [Xholon](https://github.com/kenwebb/Xholon) as an [Agent-Based Modeling](https://en.m.wikipedia.org/wiki/Agent-based_model) tool, we start with a simplest possible scenario.
**Scenario 1**
In this scenario, there is one **World** that contains one **Island** on which may live one **Fisher** (Fisherman).
As yet, there is no **Ocean** and there are no **Fish**, so there's not yet much of a living for a Fisher.
Basically, there is just an Island, a single object.
This scenario implements the shape labeled **1**, and suggests the essence of **object**.
There is one object _Island_ and one arrow _identity_.
**Scenario P**
There is now a pair of islands, each isolated from the other. There are two objects, and two identity arrows.
This scenario implements the shape labeled **P**, and suggests the essence of **pair**.
**Scenario 2**
One island now provides a directed link to the other island, but no return link.
This scenario implements the shape labeled **2**, and suggests the essence of **arrow**.
**Scenario I**
Both islands provide a directed link to the other island.
This scenario implements the shape labeled **I**, and suggests the essence of **isomorphism**.
**Xholon**
I have implemented a Graphviz parser and model generator in my own software, based on the [ANTLR](https://www.antlr.org/) example [DOT grammar](https://github.com/antlr/grammars-v4/tree/master/dot).
It only runs locally at this point.
It generates the following XML from the Graphviz specification, which Xholon then parses into an internal structure of nodes and edges.
```xml
<TheSystem>
<Node roleName="x1">
<port name="edge" index="0" connector="../Node[@roleName='x1']"/>
</Node>
<Node roleName="xp">
<port name="edge" index="0" connector="../Node[@roleName='xp']"/>
</Node>
<Node roleName="yp">
<port name="edge" index="0" connector="../Node[@roleName='yp']"/>
</Node>
<Node roleName="x2">
<port name="edge" index="0" connector="../Node[@roleName='x2']"/>
<port name="edge" index="1" connector="../Node[@roleName='y2']"/>
</Node>
<Node roleName="y2">
<port name="edge" index="0" connector="../Node[@roleName='y2']"/>
</Node>
<Node roleName="xi">
<port name="edge" index="0" connector="../Node[@roleName='xi']"/>
<port name="edge" index="1" connector="../Node[@roleName='yi']"/>
</Node>
<Node roleName="yi">
<port name="edge" index="0" connector="../Node[@roleName='yi']"/>
<port name="edge" index="1" connector="../Node[@roleName='xi']"/>
</Node>
</TheSystem>
```
An Avatar is then able to examine and move through the resulting structure. The Avatar acts as a **probe**, somewhat as described in Brendan's lecture.
The Avatar is the single element of a Set, and is able to link to any of the nodes in the Shape set. It can learn about nodes and about the edges emanating from each node.
The following is a trace of actions performed ny the Avatar.
In this example, the Avatar is controlled directly by a human.
```
You are the system Avatar avatar_42.You are in chameleon_0.
...
Moving to theSystem_392
You are in theSystem_392.
You see x1:node_394
You see xp:node_396
You see yp:node_398
You see x2:node_400
You see y2:node_403
You see xi:node_405
You see yi:node_408
Entered x1:node_394
You are in x1:node_394.
You see passage edge0 to x1:node_394
Moving along edge to x1:node_394
Moving along edge to x1:node_394
...
Moving to xp:node_396
You are the system Avatar avatar_42.You are in xp:node_396.
You are in xp:node_396.
You see passage edge0 to xp:node_396
Moving along edge to xp:node_396
Moving along edge to xp:node_396
...
Moving to yp:node_398
You are in yp:node_398.
You see passage edge0 to yp:node_398
Moving along edge to yp:node_398
Moving along edge to yp:node_398
...
Moving to x2:node_400
You are in x2:node_400.
You see passage edge0 to x2:node_400
You see passage edge1 to y2:node_403
Moving along edge to x2:node_400
Moving along edge to x2:node_400
...
Moving along edge to y2:node_403
You are in y2:node_403.
You see passage edge0 to y2:node_403
Moving along edge to y2:node_403
Moving along edge to y2:node_403
...
You are in y2:node_403.
You see passage edge0 to y2:node_403
Moving to xi:node_405
You are in xi:node_405.
You see passage edge0 to xi:node_405
You see passage edge1 to yi:node_408
Moving along edge to xi:node_405
Moving along edge to xi:node_405
...
Moving along edge to yi:node_408
Moving along edge to yi:node_408
...
Moving along edge to xi:node_405
Moving along edge to yi:node_408
Moving along edge to yi:node_408
...
Moving along edge to xi:node_405
Moving along edge to xi:node_405
...
```
**Some background on myself**
I am a software developer (C, C++, Java, JavaScript, Assembly Language, etc.).
In the past few years I have become interested in how to apply ideas from Math and Category Theory for the development of software and for understanding the world around us.
A couple of years ago I met with David (and also met Brendan) to discuss some of these connections.
I've also benefited from David's book (Category Theory for the Sciences),
from Brendan and David's newer book (An Invitation to Applied Category Theory - Seven Sketches in Compositionality),
from Bartosz's website (piggies rule!), and from everybody's videos.
To understand anything from the Math world, it always works best for me to approach it from a constructive (building and running things/code) perspective.
I'm looking forward to learning some Haskell.
<hr/>
A briefer version of this for the Azimuth Project course website.
By labeling something as an _essence_, I feel I have permission to use that thing in any way that provides some practical value.
That thing can become a useful tool, rather than a "scary Math thing".
In [lecture 2](https://www.youtube.com/watch?v=jm3bJrULMqM) (about time 5:30), Brendan introduces a notion of **Shape**.
I like this idea. Each Shape (object, pair, arrow, isomorphism) suggests _the essence of_ a basic idea in Category Theory.
An essence is not formally defined. I can play with it in my own way, with tools I'm familiar with.
This is roughly the table that Brendan presented.
```
| Shape Label | Essence Of | Objects | Arrows |
| ----------- | ----------- | ------- | ------ |
| 1 | object | 1 | 1 |
| P | pair | 2 | 2 |
| 2 | arrow | 2 | 3 |
| I | isomorphism | 2 | 4 |
```
[Graphviz](https://graphviz.org/), can roughly reproduce what Brendan drew on the blackboard.
A number of online sites can parse Graphviz .dot notation, and display it as a Scalable Vector Graphics (SVG) image.
[WebGraphviz](http://www.webgraphviz.com/) is one such site. Copy any of the following four _digraph_ lines, paste it into the WebGraphviz site, click _Generate Graph!_, and view the SVG image (as shown below).
digraph 1 {x->x; label="1 object";}
![Figure 1](https://gist.githubusercontent.com/kenwebb/b8a7893bc4723388cd6e355069c9fd55/raw/ca6b84a43225657fbc55fef19c4ccdb473882f2c/object1.svg?sanitize=true "Figure 1")
digraph P {x->x y->y; label="P pair";}
![Figure P](https://gist.githubusercontent.com/kenwebb/b8a7893bc4723388cd6e355069c9fd55/raw/ca6b84a43225657fbc55fef19c4ccdb473882f2c/pairP.svg?sanitize=true "Figure P")
digraph 2 {x->x->y->y; label="2 arrow";}
![Figure 2](https://gist.githubusercontent.com/kenwebb/b8a7893bc4723388cd6e355069c9fd55/raw/ca6b84a43225657fbc55fef19c4ccdb473882f2c/arrow2.svg?sanitize=true "Figure 2")
digraph I {x->x->y->y->x; label="I isomorphism";}
![Figure I](https://gist.githubusercontent.com/kenwebb/b8a7893bc4723388cd6e355069c9fd55/raw/ca6b84a43225657fbc55fef19c4ccdb473882f2c/isomorphismI.svg?sanitize=true "Figure I")
I wonder what other essences are lurking out there, or is this as far as we can go with this concept?
<hr/>
Some other Graphviz digraphs and graphs to try.
x and y, each with two arrows to the other node (identity arrows not shown)
graph G {x->y->x->y->x}
x and y, each with two undirected arcs
graph G {x--y--x--y--x}
x, y and z, where x has an arrow to y and an arrow to z
digraph G {x->y x->z}
digraph G {a b c}
digraph G {a->b->c}
cycle of three nodes, with identity arrows
digraph G {a->a->b->b->c->c->a}
cycle of three nodes, with double identity arrows
digraph G {a->a->a->b->b->b->c->c->c->a}
]]></markdown>
<_-.XholonClass>
<TheSystem/>
<Scenario/> <!-- Shape -->
<Island/>
</_-.XholonClass>
<xholonClassDetails>
<Scenario><Color>green</Color></Scenario>
<Island><Color>orange</Color></Island>
<Avatar><Color>red</Color></Avatar>
</xholonClassDetails>
<TheSystem>
<!-- manually created, based on the structure generated thru Graphviz -->
<Scenario roleName="1">
<Island roleName="x1">
<port name="edge" index="0" connector="../Island[@roleName='x1']"/>
</Island>
</Scenario>
<Scenario roleName="P">
<Island roleName="xp">
<port name="edge" index="0" connector="../Island[@roleName='xp']"/>
</Island>
<Island roleName="yp">
<port name="edge" index="0" connector="../Island[@roleName='yp']"/>
</Island>
</Scenario>
<Scenario roleName="2">
<Island roleName="x2">
<port name="edge" index="0" connector="../Island[@roleName='x2']"/>
<port name="edge" index="1" connector="../Island[@roleName='y2']"/>
</Island>
<Island roleName="y2">
<port name="edge" index="0" connector="../Island[@roleName='y2']"/>
</Island>
</Scenario>
<Scenario roleName="I">
<Island roleName="xi">
<port name="edge" index="0" connector="../Island[@roleName='xi']"/>
<port name="edge" index="1" connector="../Island[@roleName='yi']"/>
</Island>
<Island roleName="yi">
<port name="edge" index="0" connector="../Island[@roleName='yi']"/>
<port name="edge" index="1" connector="../Island[@roleName='xi']"/>
</Island>
</Scenario>
</TheSystem>
<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>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
<svg width="499pt" height="172pt" viewBox="0.00 0.00 499.00 172.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph1" class="graph" transform="scale(1 1) rotate(0) translate(4 168)">
<title>G</title>
<polygon fill="white" stroke="white" points="-4,5 -4,-168 496,-168 496,5 -4,5"></polygon>
<g id="graph2" class="cluster"><title>cluster_1</title>
<polygon fill="none" stroke="black" points="8,-80 8,-156 96,-156 96,-80 8,-80"></polygon>
<text text-anchor="middle" x="52" y="-139.4" font-family="Times,serif" font-size="14.00">1 object</text>
</g>
<g id="graph3" class="cluster"><title>cluster_P</title>
<polygon fill="none" stroke="black" points="104,-80 104,-156 282,-156 282,-80 104,-80"></polygon>
<text text-anchor="middle" x="193" y="-139.4" font-family="Times,serif" font-size="14.00">P pair</text>
</g>
<g id="graph4" class="cluster"><title>cluster_2</title>
<polygon fill="none" stroke="black" points="290,-8 290,-156 378,-156 378,-8 290,-8"></polygon>
<text text-anchor="middle" x="334" y="-139.4" font-family="Times,serif" font-size="14.00">2 arrow</text>
</g>
<g id="graph5" class="cluster"><title>cluster_I</title>
<polygon fill="none" stroke="black" points="386,-8 386,-156 483,-156 483,-8 386,-8"></polygon>
<text text-anchor="middle" x="434.5" y="-139.4" font-family="Times,serif" font-size="14.00">I isomorphism</text>
</g>
<!-- x1 -->
<g id="node2" class="node"><title>x1</title>
<ellipse fill="none" stroke="black" cx="43" cy="-106" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="43" y="-101.8" font-family="Times,serif" font-size="14.00">x1</text>
</g>
<!-- x1&#45;&gt;x1 -->
<g id="edge3" class="edge"><title>x1-&gt;x1</title>
<path fill="none" stroke="black" d="M62.895,-118.432C75.688,-121.675 88,-117.531 88,-106 88,-97.6218 81.5006,-93.1433 73.0395,-92.5644"></path>
<polygon fill="black" stroke="black" points="72.5019,-89.1004 62.895,-93.5679 73.191,-96.0665 72.5019,-89.1004"></polygon>
</g>
<!-- xp -->
<g id="node5" class="node"><title>xp</title>
<ellipse fill="none" stroke="black" cx="229" cy="-106" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="229" y="-101.8" font-family="Times,serif" font-size="14.00">xp</text>
</g>
<!-- xp&#45;&gt;xp -->
<g id="edge6" class="edge"><title>xp-&gt;xp</title>
<path fill="none" stroke="black" d="M248.895,-118.432C261.688,-121.675 274,-117.531 274,-106 274,-97.6218 267.501,-93.1433 259.039,-92.5644"></path>
<polygon fill="black" stroke="black" points="258.502,-89.1004 248.895,-93.5679 259.191,-96.0665 258.502,-89.1004"></polygon>
</g>
<!-- yp -->
<g id="node7" class="node"><title>yp</title>
<ellipse fill="none" stroke="black" cx="139" cy="-106" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="139" y="-101.8" font-family="Times,serif" font-size="14.00">yp</text>
</g>
<!-- yp&#45;&gt;yp -->
<g id="edge8" class="edge"><title>yp-&gt;yp</title>
<path fill="none" stroke="black" d="M158.895,-118.432C171.688,-121.675 184,-117.531 184,-106 184,-97.6218 177.501,-93.1433 169.039,-92.5644"></path>
<polygon fill="black" stroke="black" points="168.502,-89.1004 158.895,-93.5679 169.191,-96.0665 168.502,-89.1004"></polygon>
</g>
<!-- x2 -->
<g id="node10" class="node"><title>x2</title>
<ellipse fill="none" stroke="black" cx="325" cy="-106" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="325" y="-101.8" font-family="Times,serif" font-size="14.00">x2</text>
</g>
<!-- x2&#45;&gt;x2 -->
<g id="edge11" class="edge"><title>x2-&gt;x2</title>
<path fill="none" stroke="black" d="M344.895,-118.432C357.688,-121.675 370,-117.531 370,-106 370,-97.6218 363.501,-93.1433 355.039,-92.5644"></path>
<polygon fill="black" stroke="black" points="354.502,-89.1004 344.895,-93.5679 355.191,-96.0665 354.502,-89.1004"></polygon>
</g>
<!-- y2 -->
<g id="node12" class="node"><title>y2</title>
<ellipse fill="none" stroke="black" cx="325" cy="-34" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="325" y="-29.8" font-family="Times,serif" font-size="14.00">y2</text>
</g>
<!-- x2&#45;&gt;y2 -->
<g id="edge12" class="edge"><title>x2-&gt;y2</title>
<path fill="none" stroke="black" d="M325,-87.6966C325,-79.9827 325,-70.7125 325,-62.1124"></path>
<polygon fill="black" stroke="black" points="328.5,-62.1043 325,-52.1043 321.5,-62.1044 328.5,-62.1043"></polygon>
</g>
<!-- y2&#45;&gt;y2 -->
<g id="edge13" class="edge"><title>y2-&gt;y2</title>
<path fill="none" stroke="black" d="M344.895,-46.4321C357.688,-49.6753 370,-45.5313 370,-34 370,-25.6218 363.501,-21.1433 355.039,-20.5644"></path>
<polygon fill="black" stroke="black" points="354.502,-17.1004 344.895,-21.5679 355.191,-24.0665 354.502,-17.1004"></polygon>
</g>
<!-- xi -->
<g id="node14" class="node"><title>xi</title>
<ellipse fill="none" stroke="black" cx="425" cy="-106" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="425" y="-101.8" font-family="Times,serif" font-size="14.00">xi</text>
</g>
<!-- xi&#45;&gt;xi -->
<g id="edge16" class="edge"><title>xi-&gt;xi</title>
<path fill="none" stroke="black" d="M444.895,-118.432C457.688,-121.675 470,-117.531 470,-106 470,-97.6218 463.501,-93.1433 455.039,-92.5644"></path>
<polygon fill="black" stroke="black" points="454.502,-89.1004 444.895,-93.5679 455.191,-96.0665 454.502,-89.1004"></polygon>
</g>
<!-- yi -->
<g id="node16" class="node"><title>yi</title>
<ellipse fill="none" stroke="black" cx="425" cy="-34" rx="27" ry="18"></ellipse>
<text text-anchor="middle" x="425" y="-29.8" font-family="Times,serif" font-size="14.00">yi</text>
</g>
<!-- xi&#45;&gt;yi -->
<g id="edge17" class="edge"><title>xi-&gt;yi</title>
<path fill="none" stroke="black" d="M419.16,-88.411C418.297,-80.507 418.048,-70.8518 418.412,-61.9352"></path>
<polygon fill="black" stroke="black" points="421.903,-62.1791 419.121,-51.9562 414.921,-61.6831 421.903,-62.1791"></polygon>
</g>
<!-- yi&#45;&gt;xi -->
<g id="edge19" class="edge"><title>yi-&gt;xi</title>
<path fill="none" stroke="black" d="M430.879,-51.9562C431.714,-59.8272 431.948,-69.3739 431.583,-78.1869"></path>
<polygon fill="black" stroke="black" points="428.074,-78.1835 430.84,-88.411 435.056,-78.6911 428.074,-78.1835"></polygon>
</g>
<!-- yi&#45;&gt;yi -->
<g id="edge18" class="edge"><title>yi-&gt;yi</title>
<path fill="none" stroke="black" d="M444.895,-46.4321C457.688,-49.6753 470,-45.5313 470,-34 470,-25.6218 463.501,-21.1433 455.039,-20.5644"></path>
<polygon fill="black" stroke="black" points="454.502,-17.1004 444.895,-21.5679 455.191,-24.0665 454.502,-17.1004"></polygon>
</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