Merging nodes of a DAG

I would like to merge connected nodes with a specific attribute of a directed acyclic graph. After each merge operation, the graph should remain acyclic. Let’s say my graph contains blue nodes and white nodes.

enter image description here

A and B are connected, they may be merged:

enter image description here

The above graph is DAG. Merging node {A,B} with node {D} is illegal since it creates a cycle!

enter image description here

My current algorithm is based on union-find.

For each blue node b:    Make-Set(b) merge blue nodes if they are connected 

The bug is the output graph contains cycles. How can I avoid merges that create cycles in the graph?

Display more information about nodes

I have a visual graph that represents connections between nodes. User can find connection between two nodes by typing names of both ends and they get all possible paths from start node to end node like this:

enter image description here

I want to find a way to display information such as Parents, Children etc. in a pleasant way. How can I rearrange or change this to be more suitable for users?

Each option in a tree has action associated with it, for example clicking Children -> V2 will take them to that node in a graph.

Hierarchical nodes management

We want to start managing hierarchical relationships between products using (hopefully) boilerplate tree algoritms, datamodel and GUI software (involving Java and Angular).

Verticaly bound products will limit child nodes to have a price higher then a parent (or within a % % upper limit).

Nodes on a same level AND which are manually bound to each other are considered ‘horizontically’ bound and will give the same sales price to each other (according to a ‘horizontal’ rule which uses ‘lowest’ or ‘average’ or ‘most common’ price.

We only support ‘x’ hierarchy levels (like 3 or 4)

Does these type of requirements feel familiar to some one? Can you refer me some existing documentation (database models) or existing software (Java backend and/or angular JavaScript libraries)?

Number of nodes in Van-Emde-Boas tree of universe size u?

The universe size $ u$ in vEB trees is square rooted at each level until $ u = 2$ . So, unlike search trees, the branching factor is different at each level.

enter image description here

The height of the tree is $ h = \lg \lg(u)$ and $ u$ is an even power of 2, $ u = 2^{2^k}$ . I tried to calculate the count using the sum:

$ $ \sum_{i=1}^{h-1} 2^i\,2^{i + 1}$ $

But it doesn’t work. Any idea on how to do the math?

Number of ways painting graph in two colors, such that two nodes of same color are linked by edge

We are given undirected graph of $ N$ nodes and $ M$ edges, we want to count the number of possible ways to paint this graph in $ 2$ colors such that for each two nodes having the same color, there must be an edge between them.

I tried some examples on paper and I always got numbers of the form $ 2^x$ , however I couldn’t see a valid way to find such $ x$ or I couldn’t prove why this is the case.

Does this problem become easier if we are given directed acyclic graph instead of undirected one?

Nodes in a binary search tree that span a range

I have a binary search tree of height $ h$ with an integer in each leaf. I also have a range $ [\ell,u]$ . I want to find a set of nodes that span the range $ [\ell,u]$ , i.e., a set $ S$ of nodes such that the leaves under $ S$ form all (and only) those leaves containing integers in the range $ [\ell,u]$ . How large does $ S$ need to be, in the worst case, as a function of the height $ h$ ? How do I find such a set explicitly?

In what situations / with what nodes should a node ping / not ping?

I was recently looking at a network in which the client-machines that accessed a webservice endpoint, but which could not ping the webservice endpoint.

And there are other machines that can ping the webservice endpoint, but which do not utilize it.

However, the other machines do connect to service the client-machines, and of course can ping both.

All machines in question are on a private network, that extends to private and public physical locations.

So, why would some of these machines DROP packets and others ACCEPT them?

Approximation algorithm to visit all nodes in an undirected, weighted, complete graph, with shortest sum of edge weights

I’m looking for an algorithm that gives a smallest sum of ‘travel time’ within the following constraints:

  • a complete, connected, weighted graph,
  • vertices are defined in 3d euclidean space,
  • relatively low number of vertices (less than 500),
  • no limits on how many times a node may be visited,
  • a fixed starting vertex,
  • no requirement for which vertex to end at.

I’ve looked at minimum spanning tree algorithms, but those could create sub-optimal result, because they optimize for lowest summed edge weight.

I’m suspecting this may be a variant of the travelling salesman problem and thus NP-hard. For our use case however, a good approximation will be good enough.

What is needed to secure a docker container that’s running on nodes in an AWS Private Subnet with internet access only via NAT?

I know securing a container is a big deal and a lot is needed to be done to secure a default container configuration. But having it in a private subnet should take care of a lots of risks.

So what major things does one need to start with to secure a docker container that’s running on nodes in an AWS Private Subnet with internet access only via NAT?