simple graph theory terminology question - terminology

This is a probably a no brainer, and I've been searching but can't seem to find an answer. What is the term (and any alternate terms) for a graph with only two vertices and only one edge between them?
This is not a homework question :-)

The complete graph on 2 vertices. Denoted K2. See: http://en.wikipedia.org/wiki/Complete_graph

I don't know if an exact term exists, however it is a bipartite complete planar graph with 2 vertices for sure.

From further reading I found Regular Graph entry on wikipedia. It would seem to be a "1-regular graph", though there are other graphs which also qualify as such.

Related

Early abandon discord searching in Time-Series using saxpy

I am trying to look for discords (the most unusual, least similar shape) in a data-set using time-series. I came across this function in the saxpy package that outputs the discord shape. However, the link above is the only documentation that I could find and the input parameters to the function haven't been explained very well there.
More specifically,
find_best_discord_brute_force(series, win_size, global_registry, z_threshold=0.01)
What do the parameters win_size, global_registry stand for?
Also, does the series parameter require me to input SAX words?
It would be great if someone could clear this up.
Thanks!
You should use the Matrix Profile instead. Is it faster and simpler, and there is free code, see this presentation
http://www.cs.ucr.edu/~eamonn/Matrix_Profile_Tutorial_Part1.pdf
series is a numpy array of the data whose discords you are looking for.
win_size is the size of the sliding window used by sax_via_window for calculating the words representing your array.
Sorry, not sure what global_registry refers to.
For further information and documentation, there's documentation on github: https://github.com/seninp/saxpy

GRU in DeepLearning4J

I am trying to find a GRU implementation within DeepLearning4J but cannot seem to find one. Does anyone know if GRU's are implemented within DL4J? If so can you please direct me to an example. If not, is this on their roadmap anywhere?
Thanks
You can't find one because there isn't one. It's not on our roadmap because it doesn't have a clear ROI compared to LSTMs.
We have both LSTMs and Bidirectional.
In general, we've only needed one and people have bene satisfied with that.

Converting mathematical formula into an programmatic algorithm

I'm working on converting a mathematical formula into a program. This formula is called as optimal pricing policy for perishable products. I've seen this in an article and it is called Karush-Kuhn-Tucker condition. Somehow I lost all my maths skills and unable to understand the formula explained in that. I'm able to understand how to come up with a solution for getting optimal price but I'm worried that I may not address the condition given in this article. For your reference I'm giving the link here. If somebody can explain me this Karush-Kuhn-Tucker condition in plain english so that I can think in terms programming language. I'm not interested in the language, i'm ready to implement in any language.
Also giving link of question I posted in mathematics stack exchange.
Did anyone come across this kind of situation? How to come up with a programmatic solution for this kind of mathematical formula?
Wiki article for the same is here
If there are any already developed libraries for this kind of formula please let me know.
If you have a program described by KKT conditions, than you just need a nonlinear solver.
http://en.wikipedia.org/wiki/Nonlinear_programming
http://extensions.services.openoffice.org/project/NLPSolver

Drawing two-dimensional point-graphs

I've got a list of objects (probably not more than 100), where each object has a distance to all the other objects. This distance is merely the added absolute difference between all the fields these objects share. There might be few (one) or many (dozens) of fields, thus the dimensionality of the distance is not important.
I'd like to display these points in a 2D graph such that objects which have a small distance appear close together. I'm hoping this will convey clearly how many sub-groups there are in the entire list. Obviously the axes of this graph are meaningless (I'm not even sure "graph" is the correct word to use).
What would be a good algorithm to convert a network of distances into a 2D point distribution? Ideally, I'd like a small change to the distance network to result in a small change in the graphic, so that incremental progress can be viewed as a smooth change over time.
I've made a small example of the sort of result I'm looking for:
Example Graphic http://en.wiki.mcneel.com/content/upload/images/GraphExample.png
Any ideas greatly appreciated,
David
Edit:
It actually seems to have worked. I treat the entire set of values as a 2D particle cloud, construct inverse square repulsion forces between all particles and linear attraction forces based on inverse distance. It's not a stable algorithm, the result tends to spin violently whenever an additional iteration is performed, but it does always seem to generate a good separation into visual clusters:
alt text http://en.wiki.mcneel.com/content/upload/images/ParticleCloudSolution.png
I can post the C# code if anyone is interested (there's quite a lot of it sadly)
Graphviz contains implementations of several different approaches to solving this problem; consider using its spring model graph layout tools as a basis for your solution. Alternatively, its site contains a good collection of source material on the related theory.
The previous answers are probably helpful, but unfortunately given your description of the problem, it isn't guaranteed to have a solution, and in fact most of the time it won't.
I think you need to read in to cluster analysis quite a bit, because there are algorithms to sort your points into clusters based on a relatedness metric, and then you can use graphviz or something like that to draw the results. http://en.wikipedia.org/wiki/Cluster_analysis
One I quite like is a 'minimum-cut partitioning algorithm', see here: http://en.wikipedia.org/wiki/Cut_(graph_theory)
You might want to Google around for terms such as:
automatic graph layout; and
force-based algorithms.
GraphViz does implement some of these algorithms, not sure if it includes any that are useful to you.
One cautionary note -- for some algorithms small changes to your graph content can result in very large changes to the graph.

Territory Map Generation

Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)?
I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is this:
.
These hold promise, but I guess i haven't seen any straight-forward ways of rendering these, let alone holding them in some form of data structure to treat each territory as an object.
Another approach that holds promise is flood fill, but again I'm unsure on the best way to start with this approach.
Any advice would be much appreciated.
The best reference I've seen on them is Computational Geometry: Algorithms and Applications, which covers Voronoi diagrams, Delaunay triangulations (similar to Voronoi diagrams and each can be converted into the other), and other similar data structures.
They talk about all the data structures you need but they don't give you the code necessary to implement it (which may be a good exercise). In terms of code, an Amazon search shows the book Computational Geometry in C, which presumably comes with the code (although since you're stuck in C, you'd mind as well get the other one and implement it in whatever language you want). I also don't have any experience with this book, only the first.
Sorry to have only books to recommend! The only decent online resource I've seen on them are the two Wikipedia articles, which doesn't really tell you implementation details. This link may be helpful though.
Why not use a map of primitives (triangles, squares), distribute the starting points for the countries (the "capitals"), and then randomly expanding the countries by adding a random adjacent primitive to the country.
CGAL is a C++ library that has data structures and algorithms used in Computational Geometry.
I'm actually dealing with exactly this kind of stuff for my company's video game. The most useful info I've found are at these two links:
Paul Bourke's page at UWA, with his 1989 paper on Delaunay and a series of implementation links.
A great explanation of the psudocode and a visual of doing Delaunay at codeGuru.com.
In terms of rendering these - most of the implementations I've found will need massaging to get what you'd want, but since using this for a game map would lead to a number of points plus lines between them, it could be a very simple matter to do draw this out to screen.