| @@ 37-64 (lines=28) @@ | ||
| 34 | ||
| 35 | model = processes_graph_model() |
|
| 36 | ||
| 37 | if __name__ == '__main__': |
|
| 38 | use_materialize = True |
|
| 39 | ||
| 40 | if use_materialize: |
|
| 41 | # Materialize the GraphModel |
|
| 42 | graphinate.materialize( |
|
| 43 | model, |
|
| 44 | builder=graphinate.builders.GraphQLBuilder, |
|
| 45 | actualizer=graphinate.graphql |
|
| 46 | ) |
|
| 47 | ||
| 48 | else: |
|
| 49 | # Or |
|
| 50 | ||
| 51 | # 1. Define Graph Builder |
|
| 52 | builder = graphinate.builders.NetworkxBuilder(model=model) |
|
| 53 | ||
| 54 | # Then |
|
| 55 | # 2. Build the Graph object |
|
| 56 | graph: nx.Graph = builder.build() |
|
| 57 | ||
| 58 | # Then |
|
| 59 | # 3. Option A - Output to console |
|
| 60 | print(graph) |
|
| 61 | ||
| 62 | # Or |
|
| 63 | # 3. Option B - Output as a plot |
|
| 64 | graphinate.materializers.plot(graph) |
|
| 65 | ||
| @@ 24-51 (lines=28) @@ | ||
| 21 | ||
| 22 | model = get_graph_model() |
|
| 23 | ||
| 24 | if __name__ == '__main__': |
|
| 25 | use_materialize = True |
|
| 26 | ||
| 27 | if use_materialize: |
|
| 28 | # Materialize the GraphModel |
|
| 29 | graphinate.materialize( |
|
| 30 | model, |
|
| 31 | builder=graphinate.builders.GraphQLBuilder, |
|
| 32 | actualizer=graphinate.graphql |
|
| 33 | ) |
|
| 34 | ||
| 35 | else: |
|
| 36 | # Or |
|
| 37 | ||
| 38 | # 1. Define Graph Builder |
|
| 39 | builder = graphinate.builders.NetworkxBuilder(model=model) |
|
| 40 | ||
| 41 | # Then |
|
| 42 | # 2. Build the Graph object |
|
| 43 | graph: nx.Graph = builder.build() |
|
| 44 | ||
| 45 | # Then |
|
| 46 | # 3. Option A - Output to console |
|
| 47 | print(graph) |
|
| 48 | ||
| 49 | # Or |
|
| 50 | # 3. Option B - Output as a plot |
|
| 51 | graphinate.materializers.plot(graph) |
|
| 52 | ||