Questions tagged [bidirectional]

"Bidirectional" refers to any process or structure that works in two directions. Use the tag `bidi` for bidirectional text instead of this tag.

"Bidirectional" is a general concept and can have a lot of meanings:

  • bidirectional text, see
  • bidirectional associations of data
  • bidirectional synchronization
  • bidirectional mapping
  • bidirectional communication
  • bidirectional search algorithms

See also: https://en.wikipedia.org/wiki/Bidirectional

493 questions
130
votes
8 answers

How to implement an efficient bidirectional hash table?

Python dict is a very useful data-structure: d = {'a': 1, 'b': 2} d['a'] # get 1 Sometimes you'd also like to index by values. d[1] # get 'a' Which is the most efficient way to implement this data-structure? Any official recommend way to do it?
Juanjo Conti
  • 28,823
  • 42
  • 111
  • 133
103
votes
7 answers

Does Java have a HashMap with reverse lookup?

I have data that is organized in kind of a "key-key" format, rather than "key-value". It's like a HashMap, but I will need O(1) lookup in both directions. Is there a name for this type of data structure, and is anything like this included in…
Kip
  • 107,154
  • 87
  • 232
  • 265
74
votes
2 answers

Automapper: bidirectional mapping with ReverseMap() and ForMember()

I have the case where I want to map an entity to a viewmodel and back. I have to specify the mapping explicitly with ForMember() because their properties do not share the exact same names. Here is a short example of how my classes look like: public…
toni
  • 2,270
  • 3
  • 22
  • 27
31
votes
3 answers

ValueError: Tensor must be from the same graph as Tensor with Bidirectinal RNN in Tensorflow

I'm doing text tagger using Bidirectional dynamic RNN in tensorflow. After maching input's dimension, I tried to run a Session. this is blstm setting parts: fw_lstm_cell = BasicLSTMCell(LSTM_DIMS) bw_lstm_cell =…
28
votes
4 answers

Termination Criteria for Bidirectional Search

According to most of the reading I have done, a bidirectional search algorithm is said to terminate when the "forward" and "backward" frontiers first intersect. However, in Section 3.4.6 of Artificial Intelligence: A Modern Approach, Russel and…
Michael Koval
  • 8,207
  • 5
  • 42
  • 53
27
votes
4 answers

AutoMapper bidirectional mapping

If I want to do bi-directional mapping, do I need to create two mapping? Mapper.CreateMap() and Mapper.CreateMap()?
Benny
  • 8,547
  • 9
  • 60
  • 93
26
votes
4 answers

How to convert RGB -> YUV -> RGB (both ways)

I want a pair of conversion algorithms, one from RGB to YUV, the other from YUV to RGB, that are inverses of each other. That is, a round-trip conversion should leave the value unchanged. (If you like, replace YUV with Y'UV, YUV, YCbCr,…
Camille Goudeseune
  • 2,934
  • 2
  • 35
  • 56
25
votes
2 answers

Hibernate and H2 "Referential integrity constraint violation" for OneToMany bidirectional mapping

I have two simple beans--FatKid and Hamburgers. I need to be able to not only look up all of the hamburgers someone ate, but also who ate which particular hamburger. FatKid.java import java.util.List; import javax.persistence.CascadeType; import…
Kevin
  • 1,420
  • 2
  • 13
  • 11
25
votes
1 answer

How do I establish a bidirectional SSH Tunnel

Is it possible to do the following via an SSH tunnel... Host-1 establishes an SSH connection to a Remote Server I wish to log into the Remote Server and execute commands over SSH back on Host-1 Host-1 is a device that I will not have access to…
Barry
  • 722
  • 1
  • 9
  • 13
21
votes
1 answer

How do you use a Bidirectional BFS to find the shortest path?

How do you use a Bidirectional BFS to find the shortest path? Let's say there is a 6x6 grid. The start point is in (0,5) and the end point is in (4,1). What is the shortest path using bidirectional bfs? There are no path costs. And it is undirected.
16
votes
4 answers

Bidirectional data binding on a component input property

I am trying to make something work on angular2 and I am unable to find something about this behavior. I have an application that implements a custom component like this one : import {Component,Input} from 'angular2/core' @Component({ …
David Gonzalez
  • 655
  • 3
  • 6
  • 25
15
votes
2 answers

What's the main difference between bidirectional and directional sockets?

Bidirectional means the data incoming and outgoing data flows over the same channel (sockets), in classical socket it is the case. For example you want to connect to a server: you create a socket, send and receive the data over the same channel. Is…
user1844505
  • 1,259
  • 2
  • 10
  • 14
13
votes
3 answers

A bi-directional map in clojure?

What would be the best way to implement a bi-directional map in clojure? (By bi-directional map, I mean an associative map which can provide both A->B and B->A access. So in effect, the values themselves would be keys for going in the opposite…
Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99
11
votes
5 answers

Bidirectional Hash table in Ruby

I need a bidirectional Hash table in Ruby. For example: h = {:abc => 123, :xyz => 789, :qaz => 789, :wsx => [888, 999]} h.fetch(:xyz) # => 789 h.rfetch(123) # => abc h.rfetch(789) # => [:xyz, :qaz] h.rfetch(888) # => :wsx Method rfetch means…
11
votes
4 answers

Algorithm to find subset within two sets of integers whose sums match

I'm looking for an algorithm which can take two sets of integers (both positive and negative) and find subsets within each that have the same sum. The problem is similar to the subset sum problem except that I'm looking for subsets on both…
theburningmonk
  • 15,701
  • 14
  • 61
  • 104
1
2 3
32 33