úÎ!PL´7      !"#$%&'()*+,-./0123456(C) 2019 Tillmann Vogt BSD-style (see the file LICENSE)$Tillmann Vogt <tillk.vogt@gmail.com>stableGHCNone7lmK- intmap-graphMif a node label is complicated, specify a short string to understand its type intmap-graphzConvert a complex edge label to an attribute with 8 bits How to do this depends on which edges have to be filtered fast intmap-graph†The edges are enumerated, because sometimes the edge attrs are not continuous and it is impossible to try all possible 32 bit attrs  intmap-graphFA Graph of outgoing 32 bit nodeEdges with 24 bit nodes and 8 bit edges  intmap-graphFA Graph of incoming 32 bit nodeEdges with 24 bit nodes and 8 bit edges intmap-graphA tuple of nodes7 intmap-graphJAssuming that 24 bits (~16 million) is enough for Javascript UI graph code intmap-graph—In Javascript there are only 32 bit integers. If we want to squeeze a node and an edge into this we use 24 bits for the node and 8 bits for the edge intmap-graph…Generate an empty graph with 32 bit node-edges (24 bit for the node) that can be used with code that ghcjs compiled to javascript8 intmap-graphCGenerate an empty graph with 64 bit node-edges, 32 bit for the node intmap-graph¢Construct a graph from a list of nodes, undirected edges and directed edges, the bool has to be true it uses 32 bit integers, if false it uses 64 bit integers intmap-graphnConstruct a graph from a node map, undirected edges map and directed edges map, b = True means 32 bit integers intmap-graphInsert node with node label intmap-graphInsert nodes with their label intmap-graphsAdjust a node label of a specific node. When the node is not a member of the graph, the original graph is returned. intmap-graphtAdjust an edge label of a specific edge. When the edge is not a member of the graph, the original graph is returned. intmap-graphÿbInserting an edge If maybeIsBack is Nothing only one directed is edge from n0 to n1 is inserted If maybeIsBack is Just then a second directed edge from n1 to n0 is inserted isBack = True means an opposite directed edge that can be explored in both directions isBack = False means a undirected edge that also can be explored in both directions intmap-graphÿbInserting an edge If maybeIsBack is Nothing only one directed is edge from n0 to n1 is inserted If maybeIsBack is Just then a second directed edge from n1 to n0 is inserted isBack = True means an opposite directed edge that can be explored in both directions isBack = False means a undirected edge that also can be explored in both directions9 intmap-graphInserting node-edges: intmap-graph„Inserting a node edge. Exploring a graph is faster if a node and edge is combined into an 32/64 bit integer that points to a node; intmap-graphMAn 8 bit value is computed from the edge and combined with the emanating node intmap-graph.Makes a union over all components of the graph intmap-graph'Mapping a function over the node labels intmap-graph5Mapping a function over the node labels with node key intmap-graph]Delete node with its nodelabel and also all outgoing and incoming edges with their edgeLabels intmap-graphDelete nodes with their label  intmap-graphÿf"deleteEdge (n0, n1) graph" deletes the edgelabel of (n0,n1) and the nodeEdge that points from n0 to n1 If maybeIsBack is Just then a second directed edge from n1 to n0 is deleted isBack = True means an opposite directed edge that can be explored in both directions isBack = False means a undirected edge that also can be explored in both directions! intmap-graph1Delete a list of (Node,Node) edges from the graph" intmap-graphThe nodelabel of the given node# intmap-graph4The edgelabel of the given edge of type (Node, Node)$ intmap-graph/Are the node-/edge-maps of the graph all empty?% intmap-graph"The word32 keys of the node labels& intmap-graphList of (Node, Node)' intmap-graphoThe list of adjacent edges can be divided with 8 bit attributes and all edges with a certain attribute selected( intmap-graphDLooking at all incoming and outgoing edges we get all adjacent nodes) intmap-graphFollowing the outgoing edges* intmap-graphFollowing the incoming edges+ intmap-graph)Concatenate two Word32 to a Word (64 bit), intmap-graph)Extract the first 32 bit of a 64 bit word- intmap-graph*Extract the second 32 bit of a 64 bit word. intmap-graph#Nodes can use 24 bits, edges 8 bits/ intmap-graph)Extract the first 24 bit of a 32 bit word0 intmap-graph'Extract the last 8 bit of a 32 bit word1 intmap-graph8Display a 64 bit word so that we can see the bits better2 intmap-graph8Display a 32 bit word so that we can see the bits better3  !"#$%&'()*+,-./0123  !$%&"#'(*)+,-./012<       !"#$%&'()*+,-./0123456789:;<+intmap-graph-1.3.0.0-H0Ti05lTWlZJ0hgcQ2Ys78 Graph.IntMapExtractNodeTypeextractNodeType EdgeAttribute fastEdgeAttr edgeFromAttrshow_ebasesGraph outgoingNodes incomingNodes nodeLabels edgeLabels is32BitIntshowEdgeEdgeEdge8empty fromListsfromMaps insertNode insertNodes adjustNode adjustEdge insertEdge insertEdgesunionmapNodemapNodeWithKey deleteNode deleteNodes deleteEdge deleteEdges lookupNode lookupEdgeisNullnodesedgesadjacentNodesByAttr adjacentNodeschildrenparents buildWord64extractFirstWord32extractSecondWord32 buildWord32extractFirstWord24extractSecondWord8showHex showHex32 $fShowEdge8 $fEqGraph $fShowGraph$fGenericGraphNodeempty64insertNodeEdgesinsertNodeEdgeinsertNodeEdgeAttr