(n)
| 57 | |
| 58 | |
| 59 | def create_graph(n): |
| 60 | g = Graph() |
| 61 | |
| 62 | props = [ |
| 63 | {"name": "Laptop", "brand": "Dell", "ram": "16GB"}, |
| 64 | {"title": "Inception", "director": "Christopher Nolan", "year": 2010}, |
| 65 | {"city": "Paris", "country": "France", "population_millions": 2.1}, |
| 66 | {"product": "Chair", "material": "Wood"}, |
| 67 | {"animal": "Tiger", "habitat": "Forest", "endangered": True}, |
| 68 | ] |
| 69 | |
| 70 | for i in range(n): |
| 71 | shared_props = random.choice(props) |
| 72 | shared_meta = random.choice(props) |
| 73 | |
| 74 | node = g.add_node(1, i, properties=shared_props) |
| 75 | node.add_metadata(shared_meta) |
| 76 | |
| 77 | if i > 0: |
| 78 | j = random.randint(0, i - 1) |
| 79 | edge = g.add_edge(2, i, j, properties=shared_props) |
| 80 | edge.add_metadata(shared_meta) |
| 81 | |
| 82 | return g |
| 83 | |
| 84 | |
| 85 | @pytest.fixture(scope="function") |
no test coverage detected