Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望加入多边权图的生成 #82

Open
zgxkbtl opened this issue Jul 31, 2020 · 1 comment
Open

希望加入多边权图的生成 #82

zgxkbtl opened this issue Jul 31, 2020 · 1 comment

Comments

@zgxkbtl
Copy link

zgxkbtl commented Jul 31, 2020

有的题目的图会有多个边权。

@weilycoder
Copy link
Contributor

weilycoder commented Sep 30, 2024

实际上目前的代码可以实现

import random
from cyaron.graph import *

g = Graph.graph(10, 10, weight_gen = lambda: (random.randint(0, 1), random.randint(0, 1)))
print(g.to_str(output = lambda edge: "{} {} {}".format(edge.start, edge.end, edge.weight)))

输出可能是:

1 8 (0, 1)
2 7 (1, 0)
2 8 (0, 1)
2 2 (1, 0)
3 8 (1, 1)
4 7 (0, 0)
5 10 (0, 0)
6 10 (0, 0)
6 6 (1, 1)
7 9 (0, 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants