Neterukun's Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Neterukun1993/Library

:heavy_check_mark: 辺情報を頂点情報へと変換
(Graph/misc/edge_to_vertex.py)

使い方

edge_to_vertex(n: int, edges: List) -> Tuple[List, List] 重み付きの辺 edges をもつ n 頂点のグラフに対して、辺情報を頂点情報に変換した結果を返す。計算量 $O(V + E)$

備考

以下の図の通り。

Verified with

Code

def edge_to_vertex(n, edges):
    m = len(edges)
    new_edges = []
    vals = [0] * (n + m)
    for i, (u, v, val) in enumerate(edges):
        new_edges.append((u, n + i))
        new_edges.append((n + i, v))
        vals[n + i] = val
    return new_edges, vals
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.4/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page