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

ExpressionsByAtom and ExpressionsAtomsHypergraph property #409

Open
maxitg opened this issue Sep 17, 2020 · 0 comments
Open

ExpressionsByAtom and ExpressionsAtomsHypergraph property #409

maxitg opened this issue Sep 17, 2020 · 0 comments
Labels
analysis Adds or changes evolution analysis tools, e.g., `WolframModelEvolutionObject` properties feature New functionality, or change in existing functionality good first issue Good for newcomers help wanted Extra attention is needed wolfram language Requires Wolfram Language implementation

Comments

@maxitg
Copy link
Owner

maxitg commented Sep 17, 2020

The problem

"ExpressionsByAtom" property will return an association <|atom1 -> {expression1, ...}, atom2 -> {expression2, ...}|> showing which atoms appear in which expressions.

It should take the same arguments as "Expressions" property, i.e., to retrieve the result for the last state only, throughout the entire history, for a particular foliation, etc.

"ExpressionsAtomsHypergraph" will just return the values of the association above. It is a hypergraph with expressions at vertices, and hyperedges indicating which of those expressions are adjacent. It is a complement of the "AtomsExpressionsHypergraph" (also known as the spatial graph).

Possible solution

Here is the code that does that for the final state.

ExpressionsAtomsHypergraph[wmo_] := 
 Module[{ix = wmo["StateEdgeIndicesAfterEvent", -1], es}, 
  Values[Merge[
    Association @@@ (Thread /@ 
       Thread[wmo["AllExpressions"][[ix]] -> ix]), Identity]]]
In[] := ExpressionsAtomsHypergraph[
 WolframModel[{{{x, y}, {x, z}} -> {{x, z}, {x, w}, {y, w}, {z, 
      w}}}, {{0, 0}, {0, 0}}, 2]]
Out[] = {{7, 8, 9, 11, 12}, {7, 10, 11, 13, 14}, {8, 9, 10}, {12, 13, 14}}
@maxitg maxitg added feature New functionality, or change in existing functionality help wanted Extra attention is needed analysis Adds or changes evolution analysis tools, e.g., `WolframModelEvolutionObject` properties wolfram language Requires Wolfram Language implementation labels Sep 17, 2020
@maxitg maxitg added the good first issue Good for newcomers label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis Adds or changes evolution analysis tools, e.g., `WolframModelEvolutionObject` properties feature New functionality, or change in existing functionality good first issue Good for newcomers help wanted Extra attention is needed wolfram language Requires Wolfram Language implementation
Projects
None yet
Development

No branches or pull requests

1 participant