tqec
tqec copied to clipboard
Implement the random greedy ZX -> 3D algorithm for block synthesis
Is your feature request related to a problem? Please describe.
Austin proposed a greedy algorithm for block synthesis that needs to be implemented.
Describe the solution you'd like
See Austin's proposal.
Additional context
You need to implement the algorithm with the interface provided in src/tqec/interop/pyzx/synthesis/strategy.py.
@purva-thakre @angelaelisa
Could you reply here then I can assign you?
Song here. Thanks!
Hi, Yiming!
I am available to work on this implementation from March 23 onwards. Feel free to get started without me, I will keep track.
Moving @jbolns comment to this issue:
As per the last comment in the PyZX -> TQEC issue, the first page of this document has been partially and very imperfectly implemented (less the randomisation, for which there is a placeholder) here. With time, there's much room for improvement. Baby steps.
Thanks @KabirDubey . This needs to be done. 100%. I would love to team up with you. It feels like something better accomplished working together.
My baby steps are a number of small-algorithms/functions likely to be needed in any broader algorithm. Already introduced a couple in this file you linked (one to check max_n neighbours, another to ensure paths are Manhattan/taxi distance-like). They should (with some adjustments) be useful for both positioning PyZX graphs and more complete 3D structures.
Do we know the handles for Yiping and Shaopeng. The were looking for something fun. :) @Zhaoyilunnn ? @ ... ?
Thanks @KabirDubey . This needs to be done. 100%. I would love to team up with you. It feels like something better accomplished working together.
Thanks, let me check back in next week.
My baby steps are a number of small-algorithms/functions likely to be needed in any broader algorithm. Already introduced a couple in this file you linked (one to check max_n neighbours, another to ensure paths are Manhattan/taxi distance-like). They should (with some adjustments) be useful for both positioning PyZX graphs and more complete 3D structures.
I see. I suppose the first step would be integrating these helper functions with the interface provided in src/tqec/interop/pyzx/synthesis/strategy.py (that is, as a Synthesizer). I need some time to take a closer look at your code.
Do we know the handles for Yiping and Shaopeng.
I don't.
I'm going slower... First, I need to build the algorithm in SketchUp to deeply understand
And reach out anytime you'd like to chat.
On Tue, Mar 18, 2025, 7:46 AM Ángela Elisa Álvarez @.***> wrote:
I'm going slower... First, I need to build the algorithm in SketchUp to deeply understand
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2733520511, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTCJIF2AMHQCSMUQLN32VAWTXAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZTGUZDANJRGE . You are receiving this because you are subscribed to this thread.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2733520511
I'm going slower... First, I need to build the algorithm in SketchUp to deeply understand
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2733520511, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTCJIF2AMHQCSMUQLN32VAWTXAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZTGUZDANJRGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks. I am interested in working on this.
Do we know the handles for Yiping and Shaopeng. The were looking for something fun. :) @Zhaoyilunnn ? @ ... ?
Sorry I just see the message. Thanks for mentioning, it seems that many people are already working on this? I'll likely focus on my on-going issues for now, willing to help if necessary.
I've been trying to build it in SketchUp, just to understand, and I find it crazy to build. About 6 nodes remaining to be build and looks huge and difficult to connect (at least for me). I feel we need a method to determinate the relative position of each node depending on the edges, nodes connected, etc. I don't know if you have already been working on this. If not, I would like to focus on it. So, when we'll have the ZX -> 3D clear, we'll be able to build the 3D nodes and edges automatically.
Resume:
- Building big structures looks complicated by hand
- Need a method to determinate the relative position for nodes and edges of the
BlockGraph - That will allow us to build automatically the equivalent of the ZX, specially with big algorithm
What do you think? @afowler @inmzhang
@inmzhang , do we already have a branch for this?
I already have organised some of my other code into functions covering challenges specific to this task:
- extraction of PyZX graph data into a easy-to-pick dictionary
- health checks for individual nodes (needed to guide path discovery for each local optima)
- 3D plotter to easily visualise progress at any stage.
I also suggest we create a folder inside synthesis to hold scripts for specific algorithms. Else, the synthesis folder might get really messy.
do we already have a branch for this?
Not yet. I believe everyone is still working out the algorithm and developing their local versions. I don’t have a solid collaboration plan in mind yet, but maybe you could lead the discussion on how to proceed. Since there are already many people working on it, I won’t be putting much effort into this. Looking forward to your solution :-)
Fair enough. Ok, I have pushed a branch called "greedy_algo_1".
All files are in the .../synthesis folder.
./constraints.pyhas functions that basically take a node and edge and say yes/no when tested for certain validity constraints. I can't imagine an algorithm that does not need at least a few of these checks (and there is a need for much more)../extract.pyhas a pipeline to extract info from a PyZX graph (with easy-editable dictionary if something useful is currently missing)../grapher.pyhas functions to 3D-visualise a PyZX graph at any point in the process (really easy and inexpensive way to check progress).
Additionally, there is a ./algorithms/index.md file. I suggest any 3D-fication algorithms are placed there following that structure.
Typing, testing, and all that pending.
I don’t have a solid collaboration plan in mind yet, but maybe you could lead the discussion on how to proceed.
Wait, does that also mean I need to make suggestions on how to move forward, @inmzhang ?
Oh my, I have no idea. I'm a "let's wing it" kind of person. =D
...
In relation to the files above, they need a second, third, and fourth pair of eyes. Everyone's welcome. Ask me if the purpose of a file/function is not immediately obvious. So, for instance, the constraints would help to ensure the path discovery part of the algorithm doesn't add illegal operations.
Generally, I suppose breaking the task in pieces can't hurt:
- General things likely needed across more than one approach to 3D-fying graphs go to synthesis folder.
- Things specific to a given approach go into their own algorithm files as per index.md
We need to discuss here what's what, though. Or via email informally first, and the summary here, to not over-bloat things.
In my mind a good starting point for people would be to independently try to code just the breadth first search. Even without obstacles initially. Then we can add more constraints.
Best, Austin.
On Wed, Mar 19, 2025 at 8:18 AM J @.***> wrote:
I don’t have a solid collaboration plan in mind yet, but maybe you could lead the discussion on how to proceed.
Wait, does that also mean I need to make suggestions on how to move forward, @inmzhang https://github.com/inmzhang ?
Oh my, I have no idea. I'm a "let's wing it" kind of person. =D
...
In relation to the files above, they need a second, third, and fourth pair of eyes. Everyone's welcome. Ask me if the purpose of a file/function is not immediately obvious. So, for instance, the constraints would help to ensure the path discovery part of the algorithm doesn't add illegal operations.
Generally, I suppose breaking the task in pieces can't hurt:
- General things likely needed across more than one approach to 3D-fying graphs go to synthesis folder.
- Things specific to a given approach go into their own algorithm files as per index.md
We need to discuss here what's what, though. Or via email informally first, and the summary here, to not over-bloat things.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2737035273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTDWSAHNCYI6JN5SFVD2VGDC7AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZXGAZTKMRXGM . You are receiving this because you were mentioned.Message ID: @.***> [image: jbolns]jbolns left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2737035273
I don’t have a solid collaboration plan in mind yet, but maybe you could lead the discussion on how to proceed.
Wait, does that also mean I need to make suggestions on how to move forward, @inmzhang https://github.com/inmzhang ?
Oh my, I have no idea. I'm a "let's wing it" kind of person. =D
...
In relation to the files above, they need a second, third, and fourth pair of eyes. Everyone's welcome. Ask me if the purpose of a file/function is not immediately obvious. So, for instance, the constraints would help to ensure the path discovery part of the algorithm doesn't add illegal operations.
Generally, I suppose breaking the task in pieces can't hurt:
- General things likely needed across more than one approach to 3D-fying graphs go to synthesis folder.
- Things specific to a given approach go into their own algorithm files as per index.md
We need to discuss here what's what, though. Or via email informally first, and the summary here, to not over-bloat things.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2737035273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTDWSAHNCYI6JN5SFVD2VGDC7AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZXGAZTKMRXGM . You are receiving this because you were mentioned.Message ID: @.***>
a good starting point for people would be to independently try to code just the breadth first search. Even without obstacles initially. Then we can add more constraints.
Yeah, this is reasonable. In such case, perhaps still checking and/or improving .../extract.py could be worth it if the person doesn't already have an equally or better way to get the foundational PyZX information to do the BFS. Alternatively, if someone has a better way to get the info out, I really would like them to push that file up to use it myself. The better the departure point, the better the chances.
I'm personally in favor of the breadth first search being implemented using completely arbitrary self-created data structures, totally independent of the rest of the repository. I think it will be quite challenging enough even without any additional constraints. In my opinion, we can work on the input and output later.
In my opinion, you should only interact with the existing data restructures of the repository if you feel they will help you solve the breadth first search problem.
On Wed, Mar 19, 2025, 9:23 PM J @.***> wrote:
a good starting point for people would be to independently try to code just the breadth first search. Even without obstacles initially. Then we can add more constraints.
Yeah, this is reasonable. In such case, perhaps still checking and/or improving .../extract.py could be worth it if the person doesn't already have an equally or better way to get the foundational PyZX information to do the BFS. Alternatively, if someone has a better way to get the info out, I really would like them to push that file up to use it myself. The better the departure point, the better the chances.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2739110339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTFVYNKSOFH2YOHVNO32VI7E3AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGEYTAMZTHE . You are receiving this because you were mentioned.Message ID: @.***> [image: jbolns]jbolns left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2739110339
a good starting point for people would be to independently try to code just the breadth first search. Even without obstacles initially. Then we can add more constraints.
Yeah, this is reasonable. In such case, perhaps still checking and/or improving .../extract.py could be worth it if the person doesn't already have an equally or better way to get the foundational PyZX information to do the BFS. Alternatively, if someone has a better way to get the info out, I really would like them to push that file up to use it myself. The better the departure point, the better the chances.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2739110339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTFVYNKSOFH2YOHVNO32VI7E3AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGEYTAMZTHE . You are receiving this because you were mentioned.Message ID: @.***>
Ohhhhh. OK.
Everything above and a few other things I am developing locally (currently, working on unobstructed exits) I am using to solve BFS.
Having said that, now that I understand, I completely see the point. If one solves for an arbitrary input, the result should in theory be able to process a PyZX graph and more.
Fair enough. I'll continue to work locally.
I have been working on this. I feel I've hit a dead end for me. I relabeled all the nodes:
Then, I looked for neighbors (when a number has a H means it has a Hadamard:
| Node | Neighbor1 | Neighbor2 | Neighbor3 | Neighbor4 |
|---|---|---|---|---|
| 1 red | 2 red | 3 blue | 4 blue | 5 blue |
| 2 red | 1 red | 6 blue | 7 blue | |
| 3 blue | 1 red | 4H blue | 8 red | |
| 4 blue | 1 red | 3H blue | 9 blue | Port1 |
| 5 blue | 1 red | 10 red | 11 red | 12 blue |
| 6 blue | 2 red | 8 red | 13 red | 14 blue |
| 7 blue | 2 red | 10 red | Port2 | |
| 8 red | 3 blue | 6 blue | 11 red | 15 blue |
| 9 blue | 4 blue | 11 red | 13 red | |
| 10 red | 5 blue | 7 blue | 14 blue | 16 blue |
| 11 red | 5 blue | 8 red | 9 blue | |
| 12 blue | 5 blue | 17 red | 18 red | |
| 13 red | 6 blue | 9 blue | 15 blue | 18 red |
| 14 blue | 6 blue | 10 red | Port3 | Port4 |
| 15 blue | 8 red | 13 red | 16 blue | 17 red |
| 16 blue | 10 red | 15 blue | Port5 | |
| 17 red | 12 blue | 15 blue | 18H red | |
| 18 red | 12 blue | 13 red | 17H red | Port6 |
When using block_synthesis I had issues, I'm not sure if they are related to Hadamard gates, so I made a test deleting them just with Z and X nodes without creating pipes yet:
import pyzx as zx
from pyzx.utils import VertexType
from tqec.utils.position import Position3D
from tqec.interop.pyzx.synthesis.strategy import block_synthesis, SynthesisStrategy
# Define Z and X nodes
z_nodes = [3, 4, 5, 6, 9, 12, 14, 15]
x_nodes = [1, 2, 7, 8, 10, 11, 13, 16, 17, 18]
# Define neighbor connections (Hadamards omitted)
neighbors = {
1: [2, 3, 4, 5],
2: [1, 6, 7],
3: [1, 4, 8],
4: [1, 3, 9],
5: [1, 10, 11],
6: [2, 8, 13, 14],
7: [2, 10],
8: [3, 6, 11, 15],
9: [4, 10, 12],
10: [5, 7, 9, 16],
11: [5, 8, 17],
12: [9, 17, 18],
13: [6, 15, 18],
14: [6],
15: [8, 13, 16],
16: [10, 15],
17: [11, 12, 18],
18: [12, 13, 17]
}
# Create the PyZX graph
g = zx.Graph()
nodes = {}
# Create vertices
for i in range(1, 19):
vtype = VertexType.Z if i in z_nodes else VertexType.X
nodes[i] = g.add_vertex(ty=vtype)
# Add edges (omitted for now)
added_edges = set()
for src, nbs in neighbors.items():
for tgt in nbs:
edge_key = tuple(sorted((src, tgt)))
if edge_key not in added_edges:
added_edges.add(edge_key)
#g.add_edge((nodes[src], nodes[tgt]))
# Visual confirmation (optional)
print(f"Graph created with {g.num_vertices()} vertices and {g.num_edges()} edges")
# Spread nodes in a simple 6x3 grid
positions = {v: Position3D(x=i, y=0, z=0) for i, v in enumerate(g.vertices())}
# Call block_synthesis
block_graph = block_synthesis(
zx_graph=g,
strategy=SynthesisStrategy.POSITIONED,
positions=positions
)
print(f"Synthesized BlockGraph: {block_graph.num_cubes} cubes, {block_graph.num_pipes} pipes")
Result:
Graph created with 18 vertices and 0 edges
Synthesized BlockGraph: 18 cubes, 0 pipes
Only the cubes of the nodes are created:
I'll go on working on pipes, but I share the point where I'm working for anyone can review or use it.
At the same time, I'm working with the handmade SketchUp model, trying to think in a way to reduce the volume working directly in the blockgraph:
At this moment, the tool helped me to detect the nodes I used in a wrong way in SketchUp.
Would it be possible to get a sequence of images showing the algorithm in progress? Note that the intention is to first place a single node. Would be great to see this in an image. Then place a single additional node attached to this one. I was a little surprised to see the file with no edges having a large number of nodes.
On Sun, Mar 23, 2025 at 12:55 AM Ángela Elisa Álvarez < @.***> wrote:
I have been working on this. I feel I've hit a dead end for me. I relabeled all the nodes: GreedyRelabeled.png (view on web) https://github.com/user-attachments/assets/78b64b20-d5cb-44f0-9c1b-56e36623179b
Then, I looked for neighbors (when a number has a H means it has a Hadamard: Node Neighbor1 Neighbor2 Neighbor3 Neighbor4 1 red 2 red 3 blue 4 blue 5 blue 2 red 1 red 6 blue 7 blue 3 blue 1 red 4H blue 8 red 4 blue 1 red 3H blue 9 blue Port1 5 blue 1 red 10 red 11 red 12 blue 6 blue 2 red 8 red 13 red 14 blue 7 blue 2 red 10 red Port2 8 red 3 blue 6 blue 11 red 15 blue 9 blue 4 blue 11 red 13 red 10 red 5 blue 7 blue 14 blue 16 blue 11 red 5 blue 8 red 9 blue 12 blue 5 blue 17 red 18 red 13 red 6 blue 9 blue 15 blue 18 red 14 blue 6 blue 10 red Port3 Port4 15 blue 8 red 13 red 16 blue 17 red 16 blue 10 red 15 blue Port5 17 red 12 blue 15 blue 18H red 18 red 12 blue 13 red 17H red Port6
When using block_synthesis I had issues, I'm not sure if they are related to Hadamard gates, so I made a test deleting them just with Z and X nodes without creating pipes yet:
import pyzx as zx from pyzx.utils import VertexType from tqec.utils.position import Position3D from tqec.interop.pyzx.synthesis.strategy import block_synthesis, SynthesisStrategy
Define Z and X nodes
z_nodes = [3, 4, 5, 6, 9, 12, 14, 15] x_nodes = [1, 2, 7, 8, 10, 11, 13, 16, 17, 18]
Define neighbor connections (Hadamards omitted)
neighbors = { 1: [2, 3, 4, 5], 2: [1, 6, 7], 3: [1, 4, 8], 4: [1, 3, 9], 5: [1, 10, 11], 6: [2, 8, 13, 14], 7: [2, 10], 8: [3, 6, 11, 15], 9: [4, 10, 12], 10: [5, 7, 9, 16], 11: [5, 8, 17], 12: [9, 17, 18], 13: [6, 15, 18], 14: [6], 15: [8, 13, 16], 16: [10, 15], 17: [11, 12, 18], 18: [12, 13, 17] }
Create the PyZX graph
g = zx.Graph() nodes = {}
Create vertices
for i in range(1, 19): vtype = VertexType.Z if i in z_nodes else VertexType.X nodes[i] = g.add_vertex(ty=vtype)
Add edges (omitted for now)
added_edges = set() for src, nbs in neighbors.items(): for tgt in nbs: edge_key = tuple(sorted((src, tgt))) if edge_key not in added_edges: added_edges.add(edge_key) #g.add_edge((nodes[src], nodes[tgt]))
Visual confirmation (optional)
print(f"Graph created with {g.num_vertices()} vertices and {g.num_edges()} edges")
Spread nodes in a simple 6x3 grid
positions = {v: Position3D(x=i, y=0, z=0) for i, v in enumerate(g.vertices())}
Call block_synthesis
block_graph = block_synthesis( zx_graph=g, strategy=SynthesisStrategy.POSITIONED, positions=positions )
print(f"Synthesized BlockGraph: {block_graph.num_cubes} cubes, {block_graph.num_pipes} pipes")
Result:
Graph created with 18 vertices and 0 edges Synthesized BlockGraph: 18 cubes, 0 pipes
Only the cubes of the nodes are created: Screenshot.2025-03-23.at.08.45.39.png (view on web) https://github.com/user-attachments/assets/0860d26c-26d6-4ebf-9eb3-e4db38d50a57
I'll go on working on pipes, but I share the point where I'm working for anyone can review or use it.
At the same time, I'm working with the handmade SketchUp model, trying to think in a way to reduce the volume working directly in the blockgraph: Screenshot.2025-03-23.at.08.50.21.png (view on web) https://github.com/user-attachments/assets/43fa08db-81d6-468f-a86c-a99fde4621bf
At this moment, the tool helped me to detect the nodes I used in a wrong way in SketchUp.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746075788, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTBVTRRITGDDWRF5EVT2VZSIBAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGA3TKNZYHA . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746075788
I have been working on this. I feel I've hit a dead end for me. I relabeled all the nodes: GreedyRelabeled.png (view on web) https://github.com/user-attachments/assets/78b64b20-d5cb-44f0-9c1b-56e36623179b
Then, I looked for neighbors (when a number has a H means it has a Hadamard: Node Neighbor1 Neighbor2 Neighbor3 Neighbor4 1 red 2 red 3 blue 4 blue 5 blue 2 red 1 red 6 blue 7 blue 3 blue 1 red 4H blue 8 red 4 blue 1 red 3H blue 9 blue Port1 5 blue 1 red 10 red 11 red 12 blue 6 blue 2 red 8 red 13 red 14 blue 7 blue 2 red 10 red Port2 8 red 3 blue 6 blue 11 red 15 blue 9 blue 4 blue 11 red 13 red 10 red 5 blue 7 blue 14 blue 16 blue 11 red 5 blue 8 red 9 blue 12 blue 5 blue 17 red 18 red 13 red 6 blue 9 blue 15 blue 18 red 14 blue 6 blue 10 red Port3 Port4 15 blue 8 red 13 red 16 blue 17 red 16 blue 10 red 15 blue Port5 17 red 12 blue 15 blue 18H red 18 red 12 blue 13 red 17H red Port6
When using block_synthesis I had issues, I'm not sure if they are related to Hadamard gates, so I made a test deleting them just with Z and X nodes without creating pipes yet:
import pyzx as zx from pyzx.utils import VertexType from tqec.utils.position import Position3D from tqec.interop.pyzx.synthesis.strategy import block_synthesis, SynthesisStrategy
Define Z and X nodes
z_nodes = [3, 4, 5, 6, 9, 12, 14, 15] x_nodes = [1, 2, 7, 8, 10, 11, 13, 16, 17, 18]
Define neighbor connections (Hadamards omitted)
neighbors = { 1: [2, 3, 4, 5], 2: [1, 6, 7], 3: [1, 4, 8], 4: [1, 3, 9], 5: [1, 10, 11], 6: [2, 8, 13, 14], 7: [2, 10], 8: [3, 6, 11, 15], 9: [4, 10, 12], 10: [5, 7, 9, 16], 11: [5, 8, 17], 12: [9, 17, 18], 13: [6, 15, 18], 14: [6], 15: [8, 13, 16], 16: [10, 15], 17: [11, 12, 18], 18: [12, 13, 17] }
Create the PyZX graph
g = zx.Graph() nodes = {}
Create vertices
for i in range(1, 19): vtype = VertexType.Z if i in z_nodes else VertexType.X nodes[i] = g.add_vertex(ty=vtype)
Add edges (omitted for now)
added_edges = set() for src, nbs in neighbors.items(): for tgt in nbs: edge_key = tuple(sorted((src, tgt))) if edge_key not in added_edges: added_edges.add(edge_key) #g.add_edge((nodes[src], nodes[tgt]))
Visual confirmation (optional)
print(f"Graph created with {g.num_vertices()} vertices and {g.num_edges()} edges")
Spread nodes in a simple 6x3 grid
positions = {v: Position3D(x=i, y=0, z=0) for i, v in enumerate(g.vertices())}
Call block_synthesis
block_graph = block_synthesis( zx_graph=g, strategy=SynthesisStrategy.POSITIONED, positions=positions )
print(f"Synthesized BlockGraph: {block_graph.num_cubes} cubes, {block_graph.num_pipes} pipes")
Result:
Graph created with 18 vertices and 0 edges Synthesized BlockGraph: 18 cubes, 0 pipes
Only the cubes of the nodes are created: Screenshot.2025-03-23.at.08.45.39.png (view on web) https://github.com/user-attachments/assets/0860d26c-26d6-4ebf-9eb3-e4db38d50a57
I'll go on working on pipes, but I share the point where I'm working for anyone can review or use it.
At the same time, I'm working with the handmade SketchUp model, trying to think in a way to reduce the volume working directly in the blockgraph: Screenshot.2025-03-23.at.08.50.21.png (view on web) https://github.com/user-attachments/assets/43fa08db-81d6-468f-a86c-a99fde4621bf
At this moment, the tool helped me to detect the nodes I used in a wrong way in SketchUp.
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746075788, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTBVTRRITGDDWRF5EVT2VZSIBAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGA3TKNZYHA . You are receiving this because you were mentioned.Message ID: @.***>
This is the first:
I started drawing node 10 and its neighbors because it was the one with all the neighbor nodes opposites, so it was supposed to be the hardest to draw:
Then node 7 because it was just 2 neightbor nodes and an open port:
Node 2 and 1, then node 3, node 4:
And one by one until having all connected:
This is the result with all the nodes connected:
Hi Angela,
Let's back up a step. The very first image should be a single cube. The next image should have exactly 2 cubes and a single connector and describe 2 nodes of the graph completely. Let's try to get just these steps working. Edges are only added to nodes when the destination node is added.
Best, Austin.
On Sun, Mar 23, 2025 at 9:42 AM Ángela Elisa Álvarez < @.***> wrote:
This is the first:
image.png (view on web) https://github.com/user-attachments/assets/d93c4e51-f505-441e-b7cc-50cabf91472d
I started drawing node 10 and its neighbors because it was the one with all the neighbor nodes opposites, so it was supposed to be the hardest to draw: GreedyRelabeled.png (view on web) https://github.com/user-attachments/assets/e7fcc03b-ea97-422e-817c-e6a5b331e6d1
Then node 7 because it was just 2 neightbor nodes and an open port:
image.png (view on web) https://github.com/user-attachments/assets/4a37a3b5-703d-4b8a-af8b-5dedfb5371ee
Node 2 and 1, then node 3, node 4:
image.png (view on web) https://github.com/user-attachments/assets/29699e1e-f2aa-413c-bcd4-08323207dad4
And one by one until having all connected:
image.png (view on web) https://github.com/user-attachments/assets/8708ed46-11e6-4405-8408-4f9eff8ccc48
This is the result with all the nodes connected:
image.png (view on web) https://github.com/user-attachments/assets/0b0651ad-114c-4a48-b5cd-153a05d3c584
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746305406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTETAGCRSCTMISKZOF32V3P65AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGMYDKNBQGY . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746305406
This is the first:
image.png (view on web) https://github.com/user-attachments/assets/d93c4e51-f505-441e-b7cc-50cabf91472d
I started drawing node 10 and its neighbors because it was the one with all the neighbor nodes opposites, so it was supposed to be the hardest to draw: GreedyRelabeled.png (view on web) https://github.com/user-attachments/assets/e7fcc03b-ea97-422e-817c-e6a5b331e6d1
Then node 7 because it was just 2 neightbor nodes and an open port:
image.png (view on web) https://github.com/user-attachments/assets/4a37a3b5-703d-4b8a-af8b-5dedfb5371ee
Node 2 and 1, then node 3, node 4:
image.png (view on web) https://github.com/user-attachments/assets/29699e1e-f2aa-413c-bcd4-08323207dad4
And one by one until having all connected:
image.png (view on web) https://github.com/user-attachments/assets/8708ed46-11e6-4405-8408-4f9eff8ccc48
This is the result with all the nodes connected:
image.png (view on web) https://github.com/user-attachments/assets/0b0651ad-114c-4a48-b5cd-153a05d3c584
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746305406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTETAGCRSCTMISKZOF32V3P65AVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGMYDKNBQGY . You are receiving this because you were mentioned.Message ID: @.***>
@afowler like this?
The node 10:
Then the node 7:
The the edge between them:
Then the same with node 5:
The edge between node 10 and 5:
Node 7 should be connected to node 10 by a single connector with no intervening cubes. The immediate neighbors of a single initial node can always be connected to it by a single edge assuming they have no more than four edges emanating from them, as should be the case given the previous preparation step for the ZX graph.
The exits of these surrounding nodes are never obstructed. There is no need for a longer path to connect them.
Best, Austin.
On Sun, Mar 23, 2025, 11:12 AM Ángela Elisa Álvarez < @.***> wrote:
@afowler https://github.com/afowler like this?
The node 10:
image.png (view on web) https://github.com/user-attachments/assets/bea923e3-6ecb-46a8-93b5-1da18d762502
Then the node 7:
image.png (view on web) https://github.com/user-attachments/assets/1cb223be-59fd-42b7-8792-0743b8d14fdf
The the edge between them:
image.png (view on web) https://github.com/user-attachments/assets/d11d9f18-d52e-4d5f-ba62-4853cc55ab33
Then the same with node 5:
image.png (view on web) https://github.com/user-attachments/assets/9206f4d1-dd42-46fe-9f1f-52f6bd2c3231
The edge between node 10 and 5:
image.png (view on web) https://github.com/user-attachments/assets/d6d0f565-82e8-472f-be5a-2b3b9f134ccd
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746348129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTBZNXSJLH5EM7UYYK32V32PHAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2DQMJSHE . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746348129
@afowler https://github.com/afowler like this?
The node 10:
image.png (view on web) https://github.com/user-attachments/assets/bea923e3-6ecb-46a8-93b5-1da18d762502
Then the node 7:
image.png (view on web) https://github.com/user-attachments/assets/1cb223be-59fd-42b7-8792-0743b8d14fdf
The the edge between them:
image.png (view on web) https://github.com/user-attachments/assets/d11d9f18-d52e-4d5f-ba62-4853cc55ab33
Then the same with node 5:
image.png (view on web) https://github.com/user-attachments/assets/9206f4d1-dd42-46fe-9f1f-52f6bd2c3231
The edge between node 10 and 5:
image.png (view on web) https://github.com/user-attachments/assets/d6d0f565-82e8-472f-be5a-2b3b9f134ccd
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746348129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTBZNXSJLH5EM7UYYK32V32PHAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2DQMJSHE . You are receiving this because you were mentioned.Message ID: @.***>
Ok, I'm not able to see how I can connect 7 and 10 directly because they are opposite color, so I'm going to start with nodes 1 and 2:
Is this ok?
That is correct, and you can connect 10 and 7 in exactly the same structure, the only difference is the new node is blue and the arrow would point to the blue face, not the red face. Does this make sense?
On Sun, Mar 23, 2025, 11:28 AM Ángela Elisa Álvarez < @.***> wrote:
Ok, I'm not able to see how I can connect 7 and 10 directly because they are opposite color, so I'm going to start with nodes 1 and 2:
image.png (view on web) https://github.com/user-attachments/assets/b0321b2d-b8ba-4067-b6d1-2b59584ae105
Is this ok?
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746354881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTHVU6SIZKFUHFCPBXD2V34ODAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2TIOBYGE . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746354881
Ok, I'm not able to see how I can connect 7 and 10 directly because they are opposite color, so I'm going to start with nodes 1 and 2:
image.png (view on web) https://github.com/user-attachments/assets/b0321b2d-b8ba-4067-b6d1-2b59584ae105
Is this ok?
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746354881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTHVU6SIZKFUHFCPBXD2V34ODAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2TIOBYGE . You are receiving this because you were mentioned.Message ID: @.***>
Well, to be clear, a red node has two separate red faces, and the blue node would have two separate blue faces, but the picture would look the same from the angle you have provided. The color of the rightmost wall would be different.
On Sun, Mar 23, 2025, 11:35 AM Austin Fowler @.***> wrote:
That is correct, and you can connect 10 and 7 in exactly the same structure, the only difference is the new node is blue and the arrow would point to the blue face, not the red face. Does this make sense?
On Sun, Mar 23, 2025, 11:28 AM Ángela Elisa Álvarez < @.***> wrote:
Ok, I'm not able to see how I can connect 7 and 10 directly because they are opposite color, so I'm going to start with nodes 1 and 2:
image.png (view on web) https://github.com/user-attachments/assets/b0321b2d-b8ba-4067-b6d1-2b59584ae105
Is this ok?
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746354881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTHVU6SIZKFUHFCPBXD2V34ODAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2TIOBYGE . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746354881
Ok, I'm not able to see how I can connect 7 and 10 directly because they are opposite color, so I'm going to start with nodes 1 and 2:
image.png (view on web) https://github.com/user-attachments/assets/b0321b2d-b8ba-4067-b6d1-2b59584ae105
Is this ok?
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746354881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTHVU6SIZKFUHFCPBXD2V34ODAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM2TIOBYGE . You are receiving this because you were mentioned.Message ID: @.***>
Ok, that's much more easier! I thought red nodes should be ZZX and blue nodes XXZ, so it was really hard to connect them. I'll start again. Many thanks :)
And just to say it one more time to be completely clear, a blue node has precisely two opposing blue faces and these can have any orientation, and a red node has precisely two red faces and can also have any orientation.
On Sun, Mar 23, 2025, 11:49 AM Ángela Elisa Álvarez < @.***> wrote:
Ok, that's much more easier! I thought red nodes should be ZZX and blue nodes XXZ, so it was really hard to connect them. I'll start again. Many thanks :)
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746363153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTECBLXIBV7USVYBRUT2V364DAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM3DGMJVGM . You are receiving this because you were mentioned.Message ID: @.***> [image: angelaelisa]angelaelisa left a comment (tqec/tqec#523) https://github.com/tqec/tqec/issues/523#issuecomment-2746363153
Ok, that's much more easier! I thought red nodes should be ZZX and blue nodes XXZ, so it was really hard to connect them. I'll start again. Many thanks :)
— Reply to this email directly, view it on GitHub https://github.com/tqec/tqec/issues/523#issuecomment-2746363153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKAXTECBLXIBV7USVYBRUT2V364DAVCNFSM6AAAAABZG6ZTZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBWGM3DGMJVGM . You are receiving this because you were mentioned.Message ID: @.***>