vivarium-collective / bigraph-schema

compositional type schemas
Apache License 2.0
1 stars 1 forks source link

Given a place graph and a link graph, merge them into a bigraph (and vice versa) #10

Open prismofeverything opened 1 year ago

prismofeverything commented 1 year ago
placegraph = {
    'v0': {
        'v1': {},
        'v2': {
            'v3': {}}},
    'v4': {
        'v5': {}}}

hypergraph = {
    'e0': {
        'wires': {
            'e0.0': 'v0',
            'e0.1': 'v1',
            'e0.2': 'v4'}},
    'e1': {
        'wires': {
            'e0.0': 'v3',
            'e0.1': 'v1'}},
    'e2': {
        'wires': {
            'e0.0': 'v3',
            'e0.1': 'v4',
            'e0.2': 'v5'}}}

bigraph = {
    'v0': {
        'v1': {},
        'v2': {
            'v3': {}}},
    'v4': {
        'v5': {}},
    'e0': {
        'wires': {
            'e0.0': 'v0',
            'e0.1': ('v0', 'v1'),
            'e0.2': 'v4'}},
    'e1': {
        'wires': {
            'e0.0': ('v0', 'v2', 'v3'),
            'e0.1': ('v0', 'v1')}},
    'e2': {
        'wires': {
            'e0.0': ('v0', 'v2', 'v3'),
            'e0.1': 'v4',
            'e0.2': ('v4', 'v5')}}}