Skip to content

collapsed=traveled edge check, compressed edge ctor #95

Closed
TravelMapping/DataProcessing
#622

Description

@yakra

else if ((wv.second->incident_c_edges.front() == wv.second->incident_t_edges.front()
&& wv.second->incident_c_edges.back() == wv.second->incident_t_edges.back())
|| (wv.second->incident_c_edges.front() == wv.second->incident_t_edges.back()
&& wv.second->incident_c_edges.back() == wv.second->incident_t_edges.front()))

if (v.incident_c_edges[0] == v.incident_t_edges[0] and v.incident_c_edges[1] == v.incident_t_edges[1]) \
or (v.incident_c_edges[0] == v.incident_t_edges[1] and v.incident_c_edges[1] == v.incident_t_edges[0]):

Just check format mask, whether set for both formats, shouldn't matter whether incident_c_edges or incident_t_edges.
3 Python, 6 C++

Activity

  1. self-assigned this
    on May 26, 2019
  2. yakra commented on Feb 13, 2021

    @yakra
    OwnerAuthor

    Tried 2 different approaches that don't work. Time to waste a load of time figuring out why.

  3. yakra commented on Feb 13, 2021

    @yakra
    OwnerAuthor

    The 1st approach differed a bit from the OP's "check format mask, whether set for both formats" suggestion:

    if (wv.second->visibility == 1)
    	new HGEdge(wv.second, HGEdge::collapsed, numthreads);
    else if (wv.second->incident_c_edges.front()->format == wv.second->incident_t_edges.back()->format)
    	new HGEdge(wv.second, HGEdge::collapsed | HGEdge::traveled, numthreads);
    else // yadda yadda

    Failed because:
    • AK2@+SuzAve gets processed first.
    • It's hidden and in use. Thus it gets collapsed into a collapsed edge, but not a traveled edge.
    • +X235384 is adjacent.
    • It loses AK AK2 +SuzAve +X235384 from the front of its incident_c_edges list.
    • AK AK2 +X235384 GolRd, still formatted SCT, becomes the new front.
    • Its incident_t_edges list stays intact.
    • AK AK2 +X235384 GolRd, still formatted SCT, remains at the back.
    • wv.second->incident_c_edges.front() == wv.second->incident_t_edges.back(); IOW,
    • wv.second->incident_c_edges.front()->format == wv.second->incident_t_edges.back()->format
    • One dual-format edge is created, when we should instead create two single-format edges
    • Wacky antics ensue.

  4. yakra commented on Feb 14, 2021

    @yakra
    OwnerAuthor
    else if ((wv.second->incident_c_edges.front()->format & ~HGEdge::simple) == (HGEdge::collapsed | HGEdge::traveled)
          && (wv.second->incident_c_edges.back()->format  & ~HGEdge::simple) == (HGEdge::collapsed | HGEdge::traveled))

    works, per the OP.
    Even if (HGEdge::collapsed | HGEdge::traveled) is optimized to a constant by the compiler, we still have 5 logical operators + 2 -> dereference operators to get our format.
    No-build uses 7 operators iff we need to use ||. Call it... 4 (including ||) otherwise?
    One trial run had experimental @ 1.9s with no-build @ 1.8s. Good enough for me.
    No-build it is.

  5. yakra commented on Jul 31, 2021

    @yakra
    OwnerAuthor

    This part of the code will need a rethink for TravelMapping/EduTools#156.

  6. reopened this on Jul 31, 2021
  7. yakra commented on Feb 18, 2024

    @yakra
    Author
  8. yakra commented on May 3, 2024

    @yakra
    OwnerAuthor

    I think I has the solution!

    if (t_front->format & coll && t_back->format & coll)

    Or, with a bit more context.


    WRT intersection-only graphs, that's no longer a priority for me, as Jim's already implemented it as part of the graph archival process, rather than in every site update. I'm not too keen on adding more complexity to the graph generation process when it already performs so poorly on FreeBSD.

    The upcoming pull request for TMBitset-based subgraph generation will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions