tensorcircuit.applications.graphdata¶

Modules for graph instance data and more

tensorcircuit.applications.graphdata.Grid2D(m: int, n: int, pbc: bool = True) Any[source]¶
tensorcircuit.applications.graphdata.Triangle2D(m: int, n: int) Any[source]¶
tensorcircuit.applications.graphdata.all_nodes_covered(g: Any) bool[source]¶
tensorcircuit.applications.graphdata.dict2graph(d: Dict[Any, Any]) Any[source]¶

`python d = nx.to_dict_of_dicts(g) `

Parameters:

d

Returns:

tensorcircuit.applications.graphdata.dress_graph_with_cirq_qubit(g: Any) Any[source]¶
tensorcircuit.applications.graphdata.ensemble_maxcut_solution(g: Any, samples: int = 100) Tuple[float, float][source]¶
tensorcircuit.applications.graphdata.erdos_graph_generator(*args, **kwargs) Iterator[Any][source]¶
tensorcircuit.applications.graphdata.even1D(n: int, s: int = 0) Any[source]¶
tensorcircuit.applications.graphdata.get_graph(c: str) Any[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 split piece 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]