tensorcircuit.applications.graphdata¶
Modules for graph instance data and more
- tensorcircuit.applications.graphdata.dict2graph(d: Dict[Any, Any]) Any[source]¶
`python d = nx.to_dict_of_dicts(g) `- Parameters:
d
- Returns:
- tensorcircuit.applications.graphdata.ensemble_maxcut_solution(g: Any, samples: int = 100) Tuple[float, float][source]¶
- tensorcircuit.applications.graphdata.graph1D(n: int, pbc: bool = True) Any[source]¶
1D PBC chain with n sites.
- Parameters:
n (int) – The number of nodes
- Returns:
The resulted graph g
- Return type:
Graph
- tensorcircuit.applications.graphdata.maxcut_solution_bruteforce(g: Any) Tuple[float, Sequence[int]][source]¶
- tensorcircuit.applications.graphdata.odd1D(n: int, *, s: int = 1) Any¶
- tensorcircuit.applications.graphdata.reduce_edges(g: Any, m: int = 1) Sequence[Any][source]¶
- Parameters:
g
m
- Returns:
all graphs with m edge out from g
- tensorcircuit.applications.graphdata.reduced_ansatz(g: Any, ratio: int | None = None) Any[source]¶
Generate a reduced graph with given ratio of edges compared to the original graph g.
- Parameters:
g (Graph) – The base graph
ratio – number of edges kept, default half of the edges
- Returns:
The resulted reduced graph
- Return type:
Graph
- tensorcircuit.applications.graphdata.regular_graph_generator(d: int, n: int, weights: bool = False) Iterator[Any][source]¶
- tensorcircuit.applications.graphdata.split_ansatz(g: Any, split: int = 2) Sequence[Any][source]¶
Split the graph in exactly
splitpiece evenly.- Parameters:
g (Graph) – The mother graph
split (int, optional) – The number of the graph we want to divide into, defaults to 2
- Returns:
List of graph instance of size
split- Return type:
Sequence[Graph]