The preposition gēn 跟 ’with, compared with’ and the adjective yíyàng 一样/一樣 ‘the same, identical, alike’ are used to express comparative similarity or dissimilarity. It expresses that A is the same or not as B in some way.
Gēn 跟 ’with, as compared with’ and the adjective yíyàng 一样/一樣 ‘the same, identical, alike’ can be used alone to indicate whether things are the same or not, e.g. ‘you are just like me’. It can also be used to compare whether a feature of two things or people are identical or not, e.g. ‘you are as tall as me’.
Note, especially in spoken language the preposition gēn 跟 can be replaced by the preposition hé 和. In formal and written contexts yǔ 与/與 or xiàng 像 can be used instead of gēn 跟.
When asserting that something is identical yíyàng 一样/一樣 can be replaced by xiāngtóng 相同, especially in formal contexts.

Structure
Basic form
In the most basic form the preposition gēn 跟 ’with, as compared with’ introduces a point of comparison, while the adjective yíyàng一样/一樣 ‘the same, identical, alike’ marks equality or sameness. Here yíyàng一样/一樣 functions as predicate.
If A and B have a modified noun in common, B is usually shortened, and the noun is left out. In the following example shū 书/書 and xiào 笑 can be omitted from B.
If a modified noun that occurs in both A and B is already known in the context, the noun can be omitted in both A and B.
With an adjective following yíyàng 一样/一樣
Another adjective can be added after yíyàng 一样/一樣 to describe whether the people or things being compared share the same feature. Gēn 跟 ’with, as compared with’ introduces a point of comparison, while the adjective after yíyàng 一样/一樣 introduces the shared feature.
A sentence with gēn 跟 ’with, as compared with’ and the adjective yíyàng 一样/一樣 ‘the same, identical, alike’ is negated by placing the negation adverb bù 不 before yíyàng 一样/一樣.
Note that it is also possible to place the negation adverb before gēn 跟 ’with, as compared with’. This negates the relationship “with B.” This structure is used when you want to emphasize that A is not comparable to B, or that A is similar to someone else instead.
Question
There are two ways to form a yes-no question. One way is simply to place the question particle ma 吗/嗎 at the end of the sentence.
Another way to form a yes-no question is by combining the affirmative and negative forms of yíyàng 一样/一樣.
When an adjective is added as predicate after yíyàng 一样/一樣, it is still yíyàng 一样/一樣 that is being repeated. This is because the focus of the question is on whether the items being compared are similar or not, rather than the feature denoted by the adjective.
With adverbs
Adverbs such dōu 都 ‘all; both’ and yě 也 ‘also’ are placed before gēn 跟.
Degree adverbs
Degree adverbs such as hěn 很 ‘very’, fēicháng 非常 ‘very’ or tài 太 ‘very’ cannot be used in a sentence with gēn 跟 ’with, compared with’ and yíyàng 一样/一樣 ‘the same, identical, alike’.
However, adverbs, that indicates the things being compared are either exactly or approximate the same, such as wánquán 完全 ‘completely, exactly’’ or chàbuduō 差不多 ‘almost’, can be used before yíyàng 一样/一樣.
Note, wánquán 完全 ‘completely, exactly’’ is mainly used in comparisons without an adjective following yíyàng 一样/一樣.
Note, that while chàbuduō 差不多 ‘almost’, can be used before yíyàng 一样/一樣, it indicates a comparison on its own and yíyàng 一样/一樣 is often left out of the sentence. Chàbuduō 差不多 ‘almost’ is used both with and without an adjective following yíyàng 一样/一樣, that is, as both a predicate and an adverb.
Also check Chàbuduō 差不多
Functions
1. Gēn 跟… yíyàng 一样/一樣 expressing sameness/similarity
Gēn 跟 ’with, compared with’ and yíyàng一样/一樣 ‘the same, identical, alike’ can show that the items being compared are identical or equal, that A = B. It indicates that the things or people being compared are the same or just like one another.
2. Gēn 跟… yíyàng 一样/一樣 expressing similar features
Gēn 跟 ’with, compared with’ and yíyàng一样/一樣 ‘the same, identical, alike’ can also indicate whether a feature of what is being compared is the same, that is, whether they share the same quality, degree, or characteristic.
3. Gēn 跟… yíyàng 一样/一樣 expressing complete sameness/similarity
You can emphasise the sameness of what is being compared by putting wánquán 完全 ‘completely, exactly’’ before yíyàng 一样/一樣.
Wánquán 完全 ‘completely, exactly’ is mainly used in comparisons without an adjective following yíyàng一样/一樣.
Wánquán 完全 ‘completely, exactly’ is often used as an emphasis in a negated sentence.
Note, that the meaning of the sentence changes depending on whether wánquán 完全 ‘completely, exactly’ is placed before or after bù 不.
4. Gēn 跟… yíyàng 一样/一樣 expressing approximation
An approximate comparison can be made by using chàbuduō 差不多 ‘almost’.
Note, that while chàbuduō 差不多 ‘almost’, can be used before yíyàng 一样/一樣, it indicates a comparison on its own and yíyàng 一样/一樣 is often left out of the sentence.