-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
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
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`. |
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