Confusion regarding definition of path in Graph theory - path

I am having confusion regarding the definition of path.
In wikipedia the definition of path is given as follows
A path is a trail in which all vertices (except possibly the first and last) are distinct.
Definition of path in wikipedia
But what I knew was
A path is a trail in which all vertices are distinct.
Please tell me which one is the correct definition of Path.

Related

What is the name of this feature in cypher that allows depth matching rules in a path match statement? Where is the documentation?

I am having a hard time identifying the rules around this syntax, I see it and kind of understand it, but would like to find the documentation. I'm not sure how to google it though.
match (g:Group)<-[*1..2]-(s)
^^^^
^^^^ I would like to know more about this rule that limits path length
I understand that the above says "I only want to find paths that are between 1 and 2 edge traversals long", and it it really is that simple that's great; but I as I understand it the use of a star makes it a wildcard on which edges it can follow, while [:EdgeTypeIWant1..2] doesn't appear to be correct syntax. I probably have other questions as well that proper documentation (if I could find it) would be helpful with.
They are called variable length patterns.
The star is only an indicator that you're specifying a pattern of variable length, it's not a wildcard.
Your syntax would be: [:EdgeTypeIWant*1..2]

How to find a set of paths from n sources to n target?

I'm exploring a problem where I am wanting to find valid paths from multiple sources with each having a different target. I.e. a path from point a to b and a path from point c to d where the previous path from point a to b does not invalidate the path from c to d. The paths don't need to be the shortest path they just need to be valid.
The idea is that this would be working with a grid of hexagons. Like this.
Hexagon grid
With this idea in mind, each path could possibly visit the same node that a previous path did with the constraint being that they can not enter from the same node or exit to the same next node. An example of a valid path like would be: Valid Path
Likewise an invalid path would be like this: Invalid path
It's interesting and I'm currently looking into the ford-fulkerson algorithm as a possibility but if anybody had any other ideas or insight it would be greatly appreciated! If you are curious for any info I may have missed please let me know.
Thanks!

How is defined the Freak descriptor pattern

I'm have to code my own implementation of FREAK descriptor for a homework. I actually read the original paper but there isn't any explanation of how the build the pattern used.
In the OpenCV code is defined the buildPattern() function but it also lack of documentation on how the pattern itself is build.
So my question is, does anybody knows how the pattern is defined and how the parameters (radius, sigmas and coordinates) are selected?
It looks like the exact values aren't important, but Figure 4 shows the rough layout of the 43 receptive fields.
Their exact geometry is defined by the code here: https://github.com/kikohs/freak/blob/master/src/freak.cpp#L212

What's a "canonical path"?

So, an absolute path is a way to get to a certain file or location describing the full route to it, the full path, and it's OS dependent (the absolute paths for Windows and Linux, for example, are different). A relative path, on the other hand, is a route to a file or location which is described from the current location .. (two dots) indicating a superior level in the directories tree. That has been clear to me for several years now.
When searching I've even seen that there are canonicalized files too!
All I know is that CANONICAL means something like "according to the rules" or something.
Can somebody enlighten me in therms of theory about canonical stuff?
The whole point of making anything "canonical" is so that you can compare two things. For example, both ../../here/bar/x and ./test/../../bar/x may refer to the same location, but you can't do a textual comparison on the two paths. However, if you turn them into their canonical representation, they both become ../bar/x, and we see that they actually refer to the same thing.
In short, it is often the case that you have many ways of referring to one thing, and in that case you may be able to define a canonical representation which is unique and which allows you to get a handle on col­lections of such things.
(If you're looking for more examples, all of mathematics is full of "canonical" constructions for all sorts of objects, and very much with the same purpose in mind. Maybe this Wikipedia article can provide some ad­ditional directions.)
A good way to define a canonical path will be: the shortest absolute path (short, in the meaning of string-length).
This is an example of the difference between an absolute path and a canonical path:
absolute path: C:\abc\..\abc\file.txt
canonical path: C:\abc\file.txt
Canonicalization is a type of normalization which allows an object to be identified in a unique way. A relative path cannot do it, by definition.
For more info:
https://en.wikipedia.org/wiki/Canonicalization
https://en.wikipedia.org/wiki/Canonical_form
What a canonical path is (or its difference from an absolute path) is system dependent.
Typically if a (full) path contains aliases, shortcuts or symbolic links the canonical path resolves all these into the actual directories they refer.
Example: if /bin/a is a sym link, you can find it anywhere you request for an absolute path e.g. from java.io.File#getAbsolutePath while the real file (i.e. the actual target of the link) i.e. usr/local/bin/a would be return as a canonical path e.g. from java.io.File#getCanonicalPath
A good definition of a canonical path is given in the documentation of readlink in GNU Coreutils. It is specified that 'Canonicalize mode' returns an equivalent path that doesn't have any of these things:
hard links to self (.) and parent (..) directories
repeated separators (/)
symbolic links
The string length is irrelevant, as is demonstrated in the following example.
You can experiment with readlink -f (canonicalize mode) or its preferred equivalent command realpath to see the difference between an 'absolute path' and a 'canonical absolute path' for some programs on your system if you are running linux or are using GNU Coreutils.
I can get the path of 'java' on my system using which
$ which java
/usr/bin/java
This path, however, is actually a symbolic link to another symbolic link. This symbolic link chain can be displayed using namei.
$ namei $(which java)
f: /usr/bin/java
d /
d usr
d bin
l java -> /etc/alternatives/java
d /
d etc
d alternatives
l java -> /usr/lib/jvm/java-17-openjdk-amd64/bin/java
d /
d usr
d lib
d jvm
d java-17-openjdk-amd64
d bin
- java
The canonical path can be found using the previously mentioned realpath command.
$ realpath $(which java)
/usr/lib/jvm/java-17-openjdk-amd64/bin/java
The most issues with canonical paths occur when you are passing the name of a dir and not file. For file, if we are providing absolute path that is also the canonical path. But for dir it means omitting the last "/". For example, "/var/tmp/foo" is a canonical path while "/var/tmp/foo/" is not.

How to add a point to a path in Raphael (SVG)

I'm in a situation where I have a number of paths on the screen, updated several times per seconds. they are extremely simple line paths, each of them is just a simple line on canvas.
I need an efficient way of updating the paths. At the moment, I'm retrieving the path string for each of them, add 'L xx xx', and redraw. It's fine with a small number of lines, but the performance is really bad once the frequency (or the number of paths) increases.
so, the real question is - does Raphael provide a method that would just 'add a point to the path'?
I'm very new to vectors, not to mention Raphael and svg.
Would be grateful for any help
Thanks
K
I wonder what your doing ;)
Try just Maintenon the updated path and use the "path" attribute on the path
I would be interested to hear if the performance improves
Also you might like to visit my site and play with the demo there for lovely rounded paths
http://irunmywebsite.com/raphael/additionalhelp.php?v=2
Look at the technique Catmull Rom Curves it might inspire...
EXCUSE BARE LINKS AND SPELLING iPod!

Resources