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