neo4j unique shortest path

As the picture below shows we have nodes with relations but with different labels. how can I find shortest path between node A and node E with condition that relations in the path should have unique label? for example here it only should answer the path with label A
unique labeled path

graph traversal – For a set of points P, connected by weighted edges (distances) I need a path through all points while minimizing the travel on any edge longer than X

For a given set of coordinates (lat/lng) I need a path which will visit each coordinate only once. The path needs to be selected to minimize the number of times the distance between two subsequent points along the path is greater than X (ex: 200 miles).

The practical application:

I have airports on a map. I have a string of LED lights which are connected by a fixed distance of wire between them. I want the optimal path between all the airports where I minimize the number of times I need to splice additional wire into the string.

Suggestions on the approach? Maybe some type of genetic algorithm implementation?

Can the path in a graph be considered a subpath itself?

Obviously, a sub path is path that makes up a larger path in a graph, but could not the path itself be considered a sub path? Would not that path be making up the path itself? Is there a definition to confirm this?

algorithm – Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?

I’m trying to generate a random path on a 2D grid given that:

  • The width and height of the grid are given
  • The length of the path to generate is given
  • The path can’t move “back”
  • The path starts from a random point at height 0 and ends at a random point at max height
  • A path segment cannot “touch” with a path segment that is at its height – 1 that is not the latest generated segment of the previous height

This is what two paths generated from the parameters {Width:11, Length:17, PathLength:30} would look like:

generated path example 1
generated path example 2

and this is an example of a path that should not be generated:

Bad example

The result of the algorithm should be a list of value pairs such as this: (8,6) in any order, which indicates the segments of the path.
I’ve been trying to solve this problem for a while, but I have problems understanding how to make this have a given length. If the given length was not a requirement I could just generate it with a nested for cycle and some rules. Please help!

graphs – Concept of M-augmenting path to find a larger matching than $M$

I’m reading section 16.1 of the book, Combinatorial optimization, Polyhedra and efficiency by Schrijver. Here, he starts with a matching $M$ and describes a path $P$ that is $M$-augmenting if:

  1. The path has odd length (in terms of edges).
  2. Its ends are not covered by $M$.
  3. Its edges are alternately out of and in $M$.

Theorem 16.1 then states that we either have a matching of maximal size or an augmenting path exists.

I don’t understand this statement. See the graph below for example. For now, we have the edge between vertices 2 and 5 in a matching $M$. I can’t find any path that satisfies the three conditions above. Yet, this is obviously not a maximal matching since the edge between vertices 1 and 4 can be added to increase its size. What am I missing and why is my understanding so way off?

Further, if I’d used 1-4 as my initial matching, it would have been impossible to find a path that satisfies condition 2.

enter image description here

Conversely, I take the graph the the author himself provides as an example of an augmenting path. In the simple linear graph below (which is also a linked list), an augmenting path satisfying the three conditions above exists. However, where is the edge that can be added to this graph to increase the size of $M$?

enter image description here

bash – Did I create my environment variables to be stored $PATH, correctly?

trying to set up my Django application to work via CURL, not working. The issue is I have to set up my environment variables.


export DB_ADMIN
export DB_HOST
export DB_PORT
export DB

export PATH=$PATH:$DB_PORT/bin
export PATH=$PATH:$DB_ADMIN/bin
export PATH=$PATH:$DB_HOST/bin
export PATH=$PATH:$DB/bin

Could I get some verification if I set up my enviroment variables correctly? I want them to be accessible via my $PATH. Thank you in advance for your comment.

approximation – any one can help for finding tight example of steiner tree with shortest path?

1.Consider arbitrary permutation of $R={s_1,s_2,…,s_alpha }$

2.Set $Tleftarrow{s_1} $

3.$forall_{iin {2,3,…,alpha}}$

Let $P_i leftarrow$ shortest path that connecting $s_i$ to $T$

$T= Tcup P_i$

4.Return $T$

my prove is:
proof upper bound of algorithm

bip 32 hd wallets – What BIP32 derivation path does Electrum use for Multisig?

Here is what works for me when using bip32gen from bip32utils to generate the public keys which are used in the transaction, starting from an xprv master key.

For each xprv master key of a cosigner, use 0/0 for the first receiving address, 0/1 for the second, 1/0 for the first change address, 1/1 for the second change address.

Then use the corresponding public key for each cosigner, sorted into lexicographic order, when constructing the redeem script, and generate the corresponding p2sh address for each address which will be generated by Electrum.

So far as I can tell, there are no purpose codes or cosigner index, as per BIP44 or BIP45. This is with Electrum 3.2.3.


See this other stackexchange discussion: What BIP32 derivation path does Electrum use?

linux – Transmission Daemon running under custom user trying to load config from wrong path

I have transmission daemon 2.94 running as a service on a Debian 10 machine.

I changed the user running transmission daemon from default debian-transmission to www-data Apache user, since I want the save files to be readable by Apache and the opposite, Apache files to be readable by transmission.

To do that, I changed to the user setting from the following config files:

  • User=www-data in /lib/systemd/system/transmission-daemon.service
  • USER=www-data in /etc/init.d/transmission-daemon
  • setuid www-data and setgid www-data in /etc/init/transmission-daemon.conf

The transmission JSON config file still resides in /etc/transmission-daemon/settings.json. I made sure both directories /var/lib/transmission-daemon and /etc/transmission-daemon were owned by the new user www-data.

But when I relaunch the service with sudo systemctl start transmission-daemon or sudo service transmission-daemon start, I get the following in the transmission logs:

Couldn't create "/var/www/.config": Permission denied (file-posix.c:189)
Couldn't read "/var/www/.config/transmission-daemon/settings.json": No such file or directory (utils.c:238)
Couldn't save temporary file "/var/www/.config/transmission-daemon/settings.json.tmp.jq3qtN": No such file or directory (variant.c:1285)

…and other similar errors.

So it would seem transmission-daemon is trying to use the www-data user home path and recreate its config directory here.

Why is that and how can I make transmission using the previous default config path? I don’t see any transmission configuration depending on the user home path.

Side question: what is the difference between all those three config files where you set up the user running the service?

VS Code Python import path when starting in a subfolder does not behave the same in VS Code and at run time

I have a sample Python application that I’m playing around with in VS Code. The folder structure that I have is that the application is in a sub-folder. The and code-workspace files and the like are in the root of the project, and then I have a sub-folder for my application code.

I have a file that represents the entry point of the application, and other files containing supporting logic in the same folder. When I try to import from those files VS Code wants me to put a period before the module (file) name.

from .my_code_file import my_class

But that errors when I run the application. It runs just fine if I remove the leading period.

from my_code_file import my_class

Why does VS Code Intelisense think I need a period in front of the module name?