Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Sep 17, 2023
1 parent ff0a05b commit a6326a9
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
67 changes: 67 additions & 0 deletions docs/diary/2023-09-17-half-edge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Half edge
author: Xie Yuheng
date: 2023-09-17
---

```
\ | /
.-------------.
| \ | / |
| (.....) |
| | |
| (.....) |
| / | \ |
`-------------`
/ | \
```

> Although during an interaction between two nodes, new nodes and new
> interactable edges might be introduced, all of the new interactable
> edges can still be viewed as contained within the circle, during all
> the new future interactions caused by them, removing and
> reconnecting will not affect other parts of the graph outside the
> circle.
>
> -- [Programming with interaction nets / section 8](../articles/programming-with-interaction-nets.md#8)
To make implement this, we can not just give each edge an id,
and make them an entity in the entity store.

Because take the rule between `(zero)` and `(add)` as an example.

```
value value
| |
(add) => |
/ \ \
(zero) addend addend
```

After the interaction, the path between `value` and `addend` has two edges.

To reduce this path to one edge again,
first we might think of deleting edges
and introduce new edge,
but we can not to this,
for nodes outside of the "circle"
might hold reference to the edges that we want to delete.

One way to handle this (that I can think of),
is to use `HalfEdge` instead of `Edge`,
one edge consists of two `HalfEdge`s,
each `HalfEdge` has an id.

When two edges are connected,

```
A1|A2 -- B1|B2
```

we can reduce them to one edge,

```
A1|B2
```

without effecting the references to `HalfEdge`s `A1` and `B2`.
2 changes: 1 addition & 1 deletion src/app/AppReplEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class AppReplEventHandler extends ReplEventHandler {
loader = new Loader({ fetcher })

greeting(): void {
console.log(`iNet ${app.config.packageJson.version}`)
console.log(`iNet Cute ${app.config.packageJson.version}`)
}

async handle(event: ReplEvent): Promise<void> {
Expand Down

0 comments on commit a6326a9

Please sign in to comment.